7 Module implementing a data structure for login forms. |
7 Module implementing a data structure for login forms. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import QUrl |
12 from PyQt5.QtCore import QUrl, QByteArray |
13 |
13 |
14 |
14 |
15 class LoginForm(object): |
15 class LoginForm(object): |
16 """ |
16 """ |
17 Class implementing a data structure for login forms. |
17 Class implementing a data structure for login forms. |
20 """ |
20 """ |
21 Constructor |
21 Constructor |
22 """ |
22 """ |
23 self.url = QUrl() |
23 self.url = QUrl() |
24 self.name = "" |
24 self.name = "" |
25 self.hasAPassword = False |
25 self.postData = QByteArray() |
26 self.elements = [] |
|
27 # list of tuples of element name and value (string, string) |
|
28 self.elementTypes = {} |
|
29 # dict of element name as key and type as value |
|
30 |
26 |
31 def isValid(self): |
27 def isValid(self): |
32 """ |
28 """ |
33 Public method to test for validity. |
29 Public method to test for validity. |
34 |
30 |
35 @return flag indicating a valid form (boolean) |
31 @return flag indicating a valid form (boolean) |
36 """ |
32 """ |
37 return len(self.elements) > 0 |
33 return not self.url.isEmpty() and \ |
|
34 not self.postData.isEmpty() |