src/pyams_utils/__init__.py
changeset 289 c8e21d7dd685
child 292 b338586588ad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_utils/__init__.py	Wed Dec 05 12:45:56 2018 +0100
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# 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
+    include_package(config)