hooks/integrity.py
changeset 4181 c79135c217df
parent 4075 e710f4052bd6
child 4190 742e3eb16f81
--- a/hooks/integrity.py	Tue Dec 22 09:27:28 2009 +0100
+++ b/hooks/integrity.py	Tue Dec 22 10:27:49 2009 +0100
@@ -164,15 +164,14 @@
     events = ('after_add_entity', 'after_update_entity')
 
     def __call__(self):
-        schema = self._cw.vreg.schema
-        entity = self.entity
-        for attr in entity.edited_attributes:
-            if schema.rschema(attr).final:
-                constraints = [c for c in entity.e_schema.rdef(attr).constraints
+        eschema = entity.eschema
+        for attr in self.entity.edited_attributes:
+            if eschema.subjrels[attr].final:
+                constraints = [c for c in eschema.rdef(attr).constraints
                                if isinstance(c, (RQLUniqueConstraint, RQLConstraint))]
                 if constraints:
                     _CheckConstraintsOp(self._cw, constraints=constraints,
-                                        rdef=(entity.eid, attr, None))
+                                        rdef=(self.entity.eid, attr, None))
 
 
 class CheckUniqueHook(UserIntegrityHook):