Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 88.89% |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | # coding: utf-8 |
||
13 | 1 | @zope.interface.implementer(INISerializable) |
|
14 | 1 | @zope.interface.implementer(DefaultProvider) |
|
15 | 1 | class Proxy(Model): |
|
16 | 1 | host = StringType( |
|
17 | default="", |
||
18 | required=True, |
||
19 | ) |
||
20 | 1 | port = IntType( |
|
21 | default=1080, |
||
22 | required=True, |
||
23 | ) |
||
24 | 1 | user = StringType( |
|
25 | default="", |
||
26 | required=True, |
||
27 | ) |
||
28 | password = StringType( |
||
29 | default="", |
||
30 | required=True, |
||
31 | ) |
||
32 | |||
33 | 1 | @classmethod |
|
34 | def from_ini(cls, ini): |
||
35 | return cls({ |
||
36 | 'host': field_from_ini( |
||
37 | cls.host, ini, |
||
38 | 'NET', 'socksHost', |
||
39 | ), |
||
40 | 'port': field_from_ini( |
||
41 | cls.port, ini, |
||
42 | 'NET', 'socksPort', |
||
43 | ), |
||
44 | 'user': field_from_ini( |
||
45 | cls.user, ini, |
||
46 | 'NET', 'socksUser', |
||
47 | ), |
||
48 | 'password': field_from_ini( |
||
49 | cls.password, ini, |
||
50 | 'NET', 'socksPwd', |
||
51 | ), |
||
52 | }) |
||
53 | |||
54 | 1 | @classmethod |
|
55 | def default(cls): |
||
56 | return cls({ |
||
57 | field_name: field.default |
||
58 | for field_name, field in cls.fields.items() |
||
59 | }) |
||
123 |