schema.py
changeset 5159 2543cfa5d54a
parent 5122 c06078d59e87
child 5174 78438ad513ca
child 5421 8167de96c523
equal deleted inserted replaced
5158:5e9055b8c10a 5159:2543cfa5d54a
   398         if need_has_text and not has_has_text and not deletion:
   398         if need_has_text and not has_has_text and not deletion:
   399             rdef = ybo.RelationDefinition(self.type, 'has_text', 'String',
   399             rdef = ybo.RelationDefinition(self.type, 'has_text', 'String',
   400                                           __permissions__=RO_ATTR_PERMS)
   400                                           __permissions__=RO_ATTR_PERMS)
   401             self.schema.add_relation_def(rdef)
   401             self.schema.add_relation_def(rdef)
   402         elif not need_has_text and has_has_text:
   402         elif not need_has_text and has_has_text:
   403             self.schema.del_relation_def(self.type, 'has_text', 'String')
   403             # use rschema.del_relation_def and not schema.del_relation_def to
       
   404             # avoid deleting the relation type accidentally...
       
   405             self.schema['has_text'].del_relation_def(self, self.schema['String'])
   404 
   406 
   405     def schema_entity(self):
   407     def schema_entity(self):
   406         """return True if this entity type is used to build the schema"""
   408         """return True if this entity type is used to build the schema"""
   407         return self.type in SCHEMA_TYPES
   409         return self.type in SCHEMA_TYPES
   408 
   410