Total Complexity | 3 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 80% |
Changes | 6 | ||
Bugs | 0 | Features | 2 |
1 | # coding: utf-8 |
||
13 | 1 | @zope.interface.implementer(INISerializable) |
|
14 | 1 | @zope.interface.implementer(DefaultProvider) |
|
15 | 1 | class Logging(Model): |
|
16 | 1 | file_name = StringType( |
|
17 | default="eventlog.lst", |
||
18 | min_length=1, |
||
19 | required=True, |
||
20 | ) |
||
21 | 1 | keep = BooleanType( |
|
22 | default=True, |
||
23 | required=True, |
||
24 | ) |
||
25 | 1 | log_buildings = BooleanType( |
|
26 | default=False, |
||
27 | required=True, |
||
28 | ) |
||
29 | |||
30 | 1 | @classmethod |
|
31 | def from_ini(cls, ini): |
||
32 | return cls({ |
||
33 | 'file_name': field_from_ini( |
||
34 | cls.file_name, ini, |
||
35 | 'game', 'eventlog', |
||
36 | ), |
||
37 | 'keep': field_from_ini( |
||
38 | cls.keep, ini, |
||
39 | 'game', 'eventlogkeep', |
||
40 | ), |
||
41 | 'log_buildings': field_from_ini( |
||
42 | cls.log_buildings, ini, |
||
43 | 'game', 'eventlogHouse', |
||
44 | ), |
||
45 | }) |
||
46 | |||
47 | 1 | @classmethod |
|
48 | def default(cls): |
||
49 | return cls({ |
||
50 | field_name: field.default |
||
51 | for field_name, field in cls.fields.items() |
||
52 | }) |
||
85 |