Fix erroneous schema attribute access
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 16 Nov 2016 11:30:40 +0100
changeset 2007 f849b3521fd3
parent 1971 2702a778d9d4
child 2008 564ad2fb5af7
Fix erroneous schema attribute access * self.edited_entity is a SEDAStartDate, access to its parent through seda_start_date relation * when on the management tab of an archive transfer, we don't have linkto information so we've to test the entity has an eid - otherwise we know we may hide cardinality
views/simplified.py
--- a/views/simplified.py	Thu Nov 10 10:48:18 2016 +0100
+++ b/views/simplified.py	Wed Nov 16 11:30:40 2016 +0100
@@ -58,9 +58,11 @@
         if self.linked_to.get(('seda_start_date', 'subject')):
             eid = self.linked_to[('seda_start_date', 'subject')][0]
             start_date_of = self._cw.entity_from_eid(eid)
+        elif self.edited_entity.has_eid():
+            start_date_of = self.edited_entity.seda_start_date[0]
         else:
-            start_date_of = self.edited_entity.reverse_start_date_of
-        if start_date_of.cw_etype != 'SEDAContent':
+            start_date_of = None
+        if start_date_of is None or start_date_of.cw_etype != 'SEDAContent':
             attributes.remove(('user_cardinality', 'subject'))
         return attributes