src/eric7/WebBrowser/UserAgent/UserAgentWriter.py

branch
eric7
changeset 10436
f6881d10e995
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
25 25
26 def write(self, fileNameOrDevice, agents): 26 def write(self, fileNameOrDevice, agents):
27 """ 27 """
28 Public method to write a user agent data file. 28 Public method to write a user agent data file.
29 29
30 @param fileNameOrDevice name of the file to write (string) 30 @param fileNameOrDevice name of the file to write or device to write to
31 or device to write to (QIODevice) 31 @type str or QIODevice
32 @param agents dictionary with user agent data (host as key, agent 32 @param agents dictionary with user agent data (host as key, agent
33 string as value) 33 string as value)
34 @return flag indicating success (boolean) 34 @type dict
35 @return flag indicating success
36 @rtype bool
35 """ 37 """
36 if isinstance(fileNameOrDevice, QIODevice): 38 if isinstance(fileNameOrDevice, QIODevice):
37 f = fileNameOrDevice 39 f = fileNameOrDevice
38 else: 40 else:
39 f = QFile(fileNameOrDevice) 41 f = QFile(fileNameOrDevice)
47 """ 49 """
48 Private method to write a user agent file. 50 Private method to write a user agent file.
49 51
50 @param agents dictionary with user agent data (host as key, agent 52 @param agents dictionary with user agent data (host as key, agent
51 string as value) 53 string as value)
52 @return flag indicating success (boolean) 54 @type dict
55 @return flag indicating success
56 @rtype bool
53 """ 57 """
54 self.writeStartDocument() 58 self.writeStartDocument()
55 self.writeDTD("<!DOCTYPE useragents>") 59 self.writeDTD("<!DOCTYPE useragents>")
56 self.writeStartElement("UserAgents") 60 self.writeStartElement("UserAgents")
57 self.writeAttribute("version", "1.0") 61 self.writeAttribute("version", "1.0")

eric ide

mercurial