[entities] Handle cases where dataset maintainer is not a CWUser
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 17 Dec 2014 16:29:39 +0100
changeset 42 70deedd11ff0
parent 41 c7556306b72d
child 43 681487d37369
[entities] Handle cases where dataset maintainer is not a CWUser
entities.py
--- a/entities.py	Wed Dec 17 15:07:56 2014 +0100
+++ b/entities.py	Wed Dec 17 16:29:39 2014 +0100
@@ -106,9 +106,12 @@
                }
         maintainer = self.dataset_maintainer()
         if maintainer:
-            data['maintainer'] = maintainer.dc_long_title()
-            if maintainer.primary_email:
-                data['maintainer_email'] = maintainer.primary_email[0].address
+            if isinstance(maintainer, basestring):
+                data['maintainer'] = maintainer
+            else:
+                data['maintainer'] = maintainer.dc_long_title()
+                if maintainer.primary_email:
+                    data['maintainer_email'] = maintainer.primary_email[0].address
         data['tags'] = list(self.dataset_tags())
         data['extras'] = list(self.dataset_extras())
         return data