8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 """PyAMS_utils.timezone.utility module |
14 |
14 |
|
15 """ |
15 |
16 |
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from pyams_utils.interfaces.site import ISiteGenerations |
|
20 from pyams_utils.interfaces.timezone import IServerTimezone |
|
21 |
|
22 # import packages |
|
23 from persistent import Persistent |
17 from persistent import Persistent |
24 from pyams_utils.registry import utility_config |
|
25 from pyams_utils.site import check_required_utilities |
|
26 from zope.container.contained import Contained |
18 from zope.container.contained import Contained |
27 from zope.interface import implementer |
19 from zope.interface import implementer |
28 from zope.schema.fieldproperty import FieldProperty |
20 from zope.schema.fieldproperty import FieldProperty |
29 |
21 |
|
22 from pyams_utils.interfaces.site import ISiteGenerations |
|
23 from pyams_utils.interfaces.timezone import IServerTimezone |
|
24 from pyams_utils.registry import utility_config |
|
25 from pyams_utils.site import check_required_utilities |
|
26 |
|
27 |
|
28 __docformat__ = 'restructuredtext' |
|
29 |
30 |
30 |
31 @implementer(IServerTimezone) |
31 @implementer(IServerTimezone) |
32 class ServerTimezoneUtility(Persistent, Contained): |
32 class ServerTimezoneUtility(Persistent, Contained): |
|
33 """Server timezone utility""" |
33 |
34 |
34 timezone = FieldProperty(IServerTimezone['timezone']) |
35 timezone = FieldProperty(IServerTimezone['timezone']) |
35 |
36 |
36 |
37 |
37 REQUIRED_UTILITIES = ((IServerTimezone, '', ServerTimezoneUtility, 'Server timezone'),) |
38 REQUIRED_UTILITIES = ((IServerTimezone, '', ServerTimezoneUtility, 'Server timezone'),) |
38 |
39 |
39 |
40 |
40 @utility_config(name='PyAMS timezone', provides=ISiteGenerations) |
41 @utility_config(name='PyAMS timezone', provides=ISiteGenerations) |
41 class TimezoneGenerationsChecker(object): |
42 class TimezoneGenerationsChecker: |
42 """Timezone generations checker""" |
43 """Timezone generations checker""" |
43 |
44 |
44 order = 10 |
45 order = 10 |
45 generation = 1 |
46 generation = 1 |
46 |
47 |
47 def evolve(self, site, current=None): |
48 @staticmethod |
|
49 def evolve(site, current=None): # pylint: disable=unused-argument |
48 """Check for required utilities""" |
50 """Check for required utilities""" |
49 check_required_utilities(site, REQUIRED_UTILITIES) |
51 check_required_utilities(site, REQUIRED_UTILITIES) |