diff -r c60c8dec0e0e -r aaf099172bb9 schema.py --- 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: