Added adapters tests
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 Jan 2018 14:22:38 +0100
changeset 321 559ecfc5d43c
parent 320 c92db6057772
child 322 c28fc1fdcc3f
Added adapters tests
src/pyams_content/shared/common/zmi/dashboard.py
--- a/src/pyams_content/shared/common/zmi/dashboard.py	Tue Jan 16 14:21:57 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/dashboard.py	Tue Jan 16 14:22:38 2018 +0100
@@ -137,8 +137,12 @@
     def getValue(self, obj):
         target = get_parent(obj, ISequentialIdTarget)
         if target is not None:
-            sequence = get_utility(ISequentialIntIds, name=target.sequence_name)
-            return sequence.get_base_oid(ISequentialIdInfo(obj).oid, target.sequence_prefix)
+            sequence_info = ISequentialIdInfo(obj, None)
+            if sequence_info is not None:
+                sequence = get_utility(ISequentialIntIds, name=target.sequence_name)
+                return sequence.get_base_oid(sequence_info.oid, target.sequence_prefix)
+            else:
+                return '--'
         else:
             return '--'
 
@@ -246,7 +250,11 @@
     weight = 40
 
     def getValue(self, obj):
-        return format_datetime(tztime(IZopeDublinCore(obj).modified), SH_DATETIME_FORMAT, request=self.request)
+        dc = IZopeDublinCore(obj, None)
+        if dc is not None:
+            return format_datetime(tztime(dc.modified), SH_DATETIME_FORMAT, request=self.request)
+        else:
+            return '--'
 
 
 #