src/pyams_utils/__init__.py
changeset 367 2c95d34496f5
parent 292 b338586588ad
child 387 604807051f00
equal deleted inserted replaced
366:6e482f99b30e 367:2c95d34496f5
     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 """PyAMS_utils package
       
    14 
       
    15 This package provides several small modules dedicated to generic features
       
    16 for which dedicated packages are not provided. These features can concern
       
    17 date and times management, strings and unicode, lists and dictionaries,
       
    18 custom decorators to define several kinds of properties, and so on.
       
    19 """
       
    20 
    13 __docformat__ = 'restructuredtext'
    21 __docformat__ = 'restructuredtext'
    14 
    22 
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 
       
    20 # import packages
       
    21 from zope.schema.fieldproperty import FieldProperty
    23 from zope.schema.fieldproperty import FieldProperty
    22 
    24 
    23 from pyramid.i18n import TranslationStringFactory
    25 from pyramid.i18n import TranslationStringFactory
    24 _ = TranslationStringFactory('pyams_utils')
    26 _ = TranslationStringFactory('pyams_utils')
    25 
    27 
    26 
    28 
    27 def get_field_doc(self):
    29 def get_field_doc(self):
       
    30     """Try to get FieldProperty field docstring from field interface"""
    28     field = self._FieldProperty__field
    31     field = self._FieldProperty__field
    29     if field.title and field.description:
    32     if field.title and field.description:
    30         return '{0}: {1}'.format(field.title, field.description)
    33         return '{0}: {1}'.format(field.title, field.description)
    31     elif field.title:
    34     elif field.title:
    32         return field.title
    35         return field.title