entity.py
branchstable
changeset 7288 b156200ebc9d
parent 7246 ecae5b526437
parent 7287 601ad29268ab
child 7296 e559ade02665
child 7302 c281afe35b8b
equal deleted inserted replaced
7280:571b29842ef1 7288:b156200ebc9d
   270             if attr.startswith('reverse_'):
   270             if attr.startswith('reverse_'):
   271                 attr = attr[len('reverse_'):]
   271                 attr = attr[len('reverse_'):]
   272                 role = 'object'
   272                 role = 'object'
   273             else:
   273             else:
   274                 role = 'subject'
   274                 role = 'subject'
   275             assert eschema.has_relation(attr, role)
   275             assert eschema.has_relation(attr, role), '%s %s not found on %s' % (attr, role, eschema)
   276             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
   276             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
   277             if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
   277             if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
   278                 if len(value) == 1:
   278                 if len(value) == 1:
   279                     value = iter(value).next()
   279                     value = iter(value).next()
   280                 else:
   280                 else: