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") |