src/pyams_content/component/paragraph/contact.py
changeset 495 512c874493b9
parent 423 7dd6cb55f5c7
child 515 a1d5eb955e54
--- a/src/pyams_content/component/paragraph/contact.py	Thu Mar 22 15:03:30 2018 +0100
+++ b/src/pyams_content/component/paragraph/contact.py	Thu Mar 22 19:12:33 2018 +0100
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.paragraph.interfaces.contact import IContactParagraph, CONTACT_PARAGRAPH_TYPE, \
+from pyams_content.component.paragraph.interfaces.contact import have_gis, IContactParagraph, CONTACT_PARAGRAPH_TYPE, \
     CONTACT_PARAGRAPH_RENDERERS
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_file.interfaces import IImage, IResponsiveImage
@@ -49,7 +49,10 @@
     name = FieldProperty(IContactParagraph['name'])
     charge = FieldProperty(IContactParagraph['charge'])
     _photo = FileProperty(IContactParagraph['photo'])
-    gps_location = FieldProperty(IContactParagraph['gps_location'])
+
+    if have_gis:
+        gps_location = FieldProperty(IContactParagraph['gps_location'])
+
     address = FieldProperty(IContactParagraph['address'])
     renderer = FieldProperty(IContactParagraph['renderer'])
 
@@ -95,7 +98,10 @@
                     output.append(translate(MISSING_VALUE).format(field=field_title))
                 else:
                     output.append(translate(MISSING_LANG_VALUE).format(field=field_title, lang=lang))
-        for attr in ('name', 'photo', 'gps_location', 'address'):
+        attrs = ('name', 'photo', 'address')
+        if have_gis:
+            attrs += ('gps_location', )
+        for attr in attrs:
             value = getattr(self.context, attr, None)
             if not value:
                 field_title = translate(IContactParagraph[attr].title)