Helpviewer/UserAgent/UserAgentWriter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2954
bf0215fe12d1
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
28 """ 28 """
29 Public method to write a user agent data file. 29 Public method to write a user agent data file.
30 30
31 @param fileNameOrDevice name of the file to write (string) 31 @param fileNameOrDevice name of the file to write (string)
32 or device to write to (QIODevice) 32 or device to write to (QIODevice)
33 @param agents dictionary with user agent data (host as key, agent string as value) 33 @param agents dictionary with user agent data (host as key, agent
34 string as value)
35 @return flag indicating success (boolean)
34 """ 36 """
35 if isinstance(fileNameOrDevice, QIODevice): 37 if isinstance(fileNameOrDevice, QIODevice):
36 f = fileNameOrDevice 38 f = fileNameOrDevice
37 else: 39 else:
38 f = QFile(fileNameOrDevice) 40 f = QFile(fileNameOrDevice)
44 46
45 def __write(self, agents): 47 def __write(self, agents):
46 """ 48 """
47 Private method to write a user agent file. 49 Private method to write a user agent file.
48 50
49 @param agents dictionary with user agent data (host as key, agent string as value) 51 @param agents dictionary with user agent data (host as key, agent
52 string as value)
50 @return flag indicating success (boolean) 53 @return flag indicating success (boolean)
51 """ 54 """
52 self.writeStartDocument() 55 self.writeStartDocument()
53 self.writeDTD("<!DOCTYPE useragents>") 56 self.writeDTD("<!DOCTYPE useragents>")
54 self.writeStartElement("UserAgents") 57 self.writeStartElement("UserAgents")

eric ide

mercurial