src/pyams_utils/timezone/vocabulary.py
branchdev-tf
changeset 427 63284c98cdc1
parent 292 b338586588ad
equal deleted inserted replaced
426:2022e4da3ad9 427:63284c98cdc1
     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.vocabulary module
       
    14 
       
    15 This module provides a vocabulary of available timezones
       
    16 """
       
    17 
       
    18 import pytz
       
    19 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
       
    20 
       
    21 from pyams_utils.vocabulary import vocabulary_config
    14 
    22 
    15 
    23 
    16 # import standard library
    24 __docformat__ = 'restructuredtext'
    17 import pytz
       
    18 
       
    19 # import interfaces
       
    20 
       
    21 # import packages
       
    22 from pyams_utils.vocabulary import vocabulary_config
       
    23 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
       
    24 
    25 
    25 
    26 
    26 @vocabulary_config(name='PyAMS timezones')
    27 @vocabulary_config(name='PyAMS timezones')
    27 class TimezonesVocabulary(SimpleVocabulary):
    28 class TimezonesVocabulary(SimpleVocabulary):
    28     """Timezones vocabulary"""
    29     """Timezones vocabulary"""
    29 
    30 
    30     def __init__(self, *args, **kw):
    31     def __init__(self, *args, **kw):  # pylint: disable=unused-argument
    31         terms = [SimpleTerm(t, t, t) for t in pytz.all_timezones]
    32         terms = [SimpleTerm(t, t, t) for t in pytz.all_timezones]
    32         super(TimezonesVocabulary, self).__init__(terms)
    33         super(TimezonesVocabulary, self).__init__(terms)