hooks/integrity.py
changeset 3086 94ed8f0f0d14
parent 2968 0e3460341023
child 3376 f5c69485381f
--- a/hooks/integrity.py	Wed Sep 02 10:24:15 2009 +0200
+++ b/hooks/integrity.py	Wed Sep 02 10:53:51 2009 +0200
@@ -163,11 +163,11 @@
         entity = self.entity
         eschema = entity.e_schema
         for attr in entity.edited_attributes:
-            val = entity[attr]
-            if val is None:
-                continue
             if eschema.subject_relation(attr).is_final() and \
                    eschema.has_unique_values(attr):
+                val = entity[attr]
+                if val is None:
+                    continue
                 rql = '%s X WHERE X %s %%(val)s' % (entity.e_schema, attr)
                 rset = self._cw.unsafe_execute(rql, {'val': val})
                 if rset and rset[0][0] != entity.eid: