schema.py
changeset 9635 aaf099172bb9
parent 9547 43aace16a953
parent 9600 bde625698f44
child 9660 a78efec4cf04
--- a/schema.py	Mon Apr 07 14:15:35 2014 +0200
+++ b/schema.py	Mon Apr 07 17:02:04 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: