26 """ |
26 """ |
27 Public method to write a user agent data file. |
27 Public method to write a user agent data file. |
28 |
28 |
29 @param fileNameOrDevice name of the file to write (string) |
29 @param fileNameOrDevice name of the file to write (string) |
30 or device to write to (QIODevice) |
30 or device to write to (QIODevice) |
31 @param agents dictionary with user agent data (host as key, agent string as value) |
31 @param agents dictionary with user agent data (host as key, agent |
|
32 string as value) |
|
33 @return flag indicating success (boolean) |
32 """ |
34 """ |
33 if isinstance(fileNameOrDevice, QIODevice): |
35 if isinstance(fileNameOrDevice, QIODevice): |
34 f = fileNameOrDevice |
36 f = fileNameOrDevice |
35 else: |
37 else: |
36 f = QFile(fileNameOrDevice) |
38 f = QFile(fileNameOrDevice) |
42 |
44 |
43 def __write(self, agents): |
45 def __write(self, agents): |
44 """ |
46 """ |
45 Private method to write a user agent file. |
47 Private method to write a user agent file. |
46 |
48 |
47 @param agents dictionary with user agent data (host as key, agent string as value) |
49 @param agents dictionary with user agent data (host as key, agent |
|
50 string as value) |
48 @return flag indicating success (boolean) |
51 @return flag indicating success (boolean) |
49 """ |
52 """ |
50 self.writeStartDocument() |
53 self.writeStartDocument() |
51 self.writeDTD("<!DOCTYPE useragents>") |
54 self.writeDTD("<!DOCTYPE useragents>") |
52 self.writeStartElement("UserAgents") |
55 self.writeStartElement("UserAgents") |