src/pyams_utils/__init__.py
branchdoc-dc
changeset 253 146a0deffad8
parent 252 05af55de9eab
parent 170 0013ddcfdc37
--- a/src/pyams_utils/__init__.py	Mon Apr 09 17:05:53 2018 +0200
+++ b/src/pyams_utils/__init__.py	Thu Apr 12 11:43:16 2018 +0200
@@ -21,11 +21,25 @@
 # import interfaces
 
 # import packages
+from zope.schema.fieldproperty import FieldProperty
 
 from pyramid.i18n import TranslationStringFactory
 _ = TranslationStringFactory('pyams_utils')
 
 
+def get_field_doc(self):
+    field = self._FieldProperty__field
+    if field.title and field.description:
+        return '{0}: {1}'.format(field.title, field.description)
+    elif field.title:
+        return field.title
+    else:
+        return super(self.__class__, self).__doc__
+
+
+FieldProperty.__doc__ = property(get_field_doc)
+
+
 def includeme(config):
     """pyams_utils features include"""
     from .include import include_package