schema.py
branchstable
changeset 9600 bde625698f44
parent 9395 96dba2efd16d
parent 9565 fa00fc251d57
child 9635 aaf099172bb9
child 9928 0d831b40fa48
--- a/schema.py	Tue Apr 01 14:46:55 2014 +0200
+++ b/schema.py	Tue Apr 01 18:09:46 2014 +0200
@@ -350,6 +350,13 @@
             return self._check(_cw, x=eid, **kwargs)
         return self._check(_cw, **kwargs)
 
+def constraint_by_eid(self, eid):
+    for cstr in self.constraints:
+        if cstr.eid == eid:
+            return cstr
+    raise ValueError('No constraint with eid %d' % eid)
+RelationDefinitionSchema.constraint_by_eid = constraint_by_eid
+
 
 def vargraph(rqlst):
     """ builds an adjacency graph of variables from the rql syntax tree, e.g: