entity.py
changeset 8216 99ff746e8de8
parent 8190 2a3c1b787688
parent 8199 fb5c0e60a615
child 8307 8be58694f416
equal deleted inserted replaced
8214:ce9556358dbd 8216:99ff746e8de8
   479             else:
   479             else:
   480                 role = 'subject'
   480                 role = 'subject'
   481             assert eschema.has_relation(attr, role), '%s %s not found on %s' % (attr, role, eschema)
   481             assert eschema.has_relation(attr, role), '%s %s not found on %s' % (attr, role, eschema)
   482             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
   482             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
   483             if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
   483             if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
   484                 if len(value) == 1:
   484                 if len(value) == 0:
       
   485                     continue # avoid crash with empty IN clause
       
   486                 elif len(value) == 1:
   485                     value = iter(value).next()
   487                     value = iter(value).next()
   486                 else:
   488                 else:
   487                     # prepare IN clause
   489                     # prepare IN clause
   488                     pending_relations.append( (attr, role, value) )
   490                     pending_relations.append( (attr, role, value) )
   489                     continue
   491                     continue