schema.py
changeset 5558 afd1face1faf
parent 5531 0ce62ac0d1d7
child 5707 3586d36d2a45
equal deleted inserted replaced
5557:1a534c596bff 5558:afd1face1faf
   566         :param: the newly created or just completed relation schema
   566         :param: the newly created or just completed relation schema
   567         """
   567         """
   568         rdef.name = rdef.name.lower()
   568         rdef.name = rdef.name.lower()
   569         rdef.subject = bw_normalize_etype(rdef.subject)
   569         rdef.subject = bw_normalize_etype(rdef.subject)
   570         rdef.object = bw_normalize_etype(rdef.object)
   570         rdef.object = bw_normalize_etype(rdef.object)
   571         rdefs = super(CubicWebSchema, self).add_relation_def(rdef)
   571         try:
       
   572             rdefs = super(CubicWebSchema, self).add_relation_def(rdef)
       
   573         except BadSchemaDefinition:
       
   574             reversed_etype_map = dict( (v, k) for k, v in ETYPE_NAME_MAP.iteritems() )
       
   575             if rdef.subject in reversed_etype_map or rdef.object in reversed_etype_map:
       
   576                 self.warning('huuuu')
       
   577                 return
       
   578             raise
   572         if rdefs:
   579         if rdefs:
   573             try:
   580             try:
   574                 self._eid_index[rdef.eid] = rdefs
   581                 self._eid_index[rdef.eid] = rdefs
   575             except AttributeError:
   582             except AttributeError:
   576                 pass # not a serialized schema
   583                 pass # not a serialized schema