schema.py
branchstable
changeset 9565 fa00fc251d57
parent 9280 bae0caa8477a
child 9600 bde625698f44
equal deleted inserted replaced
9564:e2d5b0712974 9565:fa00fc251d57
   320                 raise BadSchemaDefinition(msg % self)
   320                 raise BadSchemaDefinition(msg % self)
   321             if not self.final and isinstance(group_or_rqlexpr, ERQLExpression):
   321             if not self.final and isinstance(group_or_rqlexpr, ERQLExpression):
   322                 msg = "can't use ERQLExpression on %s, use a RRQLExpression"
   322                 msg = "can't use ERQLExpression on %s, use a RRQLExpression"
   323                 raise BadSchemaDefinition(msg % self)
   323                 raise BadSchemaDefinition(msg % self)
   324 RelationDefinitionSchema.check_permission_definitions = check_permission_definitions
   324 RelationDefinitionSchema.check_permission_definitions = check_permission_definitions
       
   325 
       
   326 def constraint_by_eid(self, eid):
       
   327     for cstr in self.constraints:
       
   328         if cstr.eid == eid:
       
   329             return cstr
       
   330     raise ValueError('No constraint with eid %d' % eid)
       
   331 RelationDefinitionSchema.constraint_by_eid = constraint_by_eid
   325 
   332 
   326 
   333 
   327 class CubicWebEntitySchema(EntitySchema):
   334 class CubicWebEntitySchema(EntitySchema):
   328     """a entity has a type, a set of subject and or object relations
   335     """a entity has a type, a set of subject and or object relations
   329     the entity schema defines the possible relations for a given type and some
   336     the entity schema defines the possible relations for a given type and some