Updated DocFieldProperty to correctly get fields description
authorThierry Florac <thierry.florac@onf.fr>
Thu, 11 Jan 2018 16:51:53 +0100
changeset 122 88f33861b143
parent 121 2d5da1421297
child 123 9ac65a867f3e
Updated DocFieldProperty to correctly get fields description
src/pyams_utils/property.py
--- a/src/pyams_utils/property.py	Wed Dec 13 09:03:48 2017 +0100
+++ b/src/pyams_utils/property.py	Thu Jan 11 16:51:53 2018 +0100
@@ -30,7 +30,13 @@
 
     @property
     def __doc__(self):
-        return self._FieldProperty__field.description or super(FieldProperty, self).__doc__
+        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(FieldProperty, self).__doc__
 
 
 class cached(object):