equal
deleted
inserted
replaced
1006 rschema = self.add_relation_type(ybo.RelationType('identity')) |
1006 rschema = self.add_relation_type(ybo.RelationType('identity')) |
1007 rschema.final = False |
1007 rschema.final = False |
1008 |
1008 |
1009 etype_name_re = r'[A-Z][A-Za-z0-9]*[a-z]+[A-Za-z0-9]*$' |
1009 etype_name_re = r'[A-Z][A-Za-z0-9]*[a-z]+[A-Za-z0-9]*$' |
1010 |
1010 |
|
1011 @cachedproperty |
|
1012 def rules_rqlexpr_mapping(self): |
|
1013 """Return a dictionary mapping rtype to RRQLExpression for computed |
|
1014 relations. |
|
1015 """ |
|
1016 rules = {} |
|
1017 for rschema in self.iter_computed_relations(): |
|
1018 rules[rschema.type] = RRQLExpression(rschema.rule) |
|
1019 return rules |
|
1020 |
1011 def add_entity_type(self, edef): |
1021 def add_entity_type(self, edef): |
1012 edef.name = str(edef.name) |
1022 edef.name = str(edef.name) |
1013 edef.name = bw_normalize_etype(edef.name) |
1023 edef.name = bw_normalize_etype(edef.name) |
1014 if not re.match(self.etype_name_re, edef.name): |
1024 if not re.match(self.etype_name_re, edef.name): |
1015 raise BadSchemaDefinition( |
1025 raise BadSchemaDefinition( |
1146 |
1156 |
1147 def rebuild_infered_relations(self): |
1157 def rebuild_infered_relations(self): |
1148 super(CubicWebSchema, self).rebuild_infered_relations() |
1158 super(CubicWebSchema, self).rebuild_infered_relations() |
1149 self.finalize_computed_attributes() |
1159 self.finalize_computed_attributes() |
1150 self.finalize_computed_relations() |
1160 self.finalize_computed_relations() |
|
1161 # remove @cachedproperty cache |
|
1162 self.__dict__.pop('rules_rqlexpr_mapping', None) |
1151 |
1163 |
1152 |
1164 |
1153 # additional cw specific constraints ########################################### |
1165 # additional cw specific constraints ########################################### |
1154 |
1166 |
1155 @monkeypatch(BaseConstraint) |
1167 @monkeypatch(BaseConstraint) |