Helpviewer/Passwords/PasswordWriter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
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 logins dictionary with login data (user name, password) 33 @param logins dictionary with login data (user name, password)
34 @param forms list of forms data (list of LoginForm) 34 @param forms list of forms data (list of LoginForm)
35 @param nevers list of URLs to never store data for (list of strings) 35 @param nevers list of URLs to never store data for (list of strings)
36 @return flag indicating success (boolean)
36 """ 37 """
37 if isinstance(fileNameOrDevice, QIODevice): 38 if isinstance(fileNameOrDevice, QIODevice):
38 f = fileNameOrDevice 39 f = fileNameOrDevice
39 else: 40 else:
40 f = QFile(fileNameOrDevice) 41 f = QFile(fileNameOrDevice)
92 for key, form in forms.items(): 93 for key, form in forms.items():
93 self.writeStartElement("Form") 94 self.writeStartElement("Form")
94 self.writeAttribute("key", key) 95 self.writeAttribute("key", key)
95 self.writeAttribute("url", form.url.toString()) 96 self.writeAttribute("url", form.url.toString())
96 self.writeAttribute("name", str(form.name)) 97 self.writeAttribute("name", str(form.name))
97 self.writeAttribute("password", "yes" if form.hasAPassword else "no") 98 self.writeAttribute(
99 "password", "yes" if form.hasAPassword else "no")
98 if form.elements: 100 if form.elements:
99 self.writeStartElement("Elements") 101 self.writeStartElement("Elements")
100 for element in form.elements: 102 for element in form.elements:
101 self.writeEmptyElement("Element") 103 self.writeEmptyElement("Element")
102 self.writeAttribute("name", element[0]) 104 self.writeAttribute("name", element[0])

eric ide

mercurial