entity.py
branchstable
changeset 8199 fb5c0e60a615
parent 7995 9a9f35ef418c
child 8216 99ff746e8de8
child 8286 8b0146e31baa
--- a/entity.py	Wed Feb 08 14:17:09 2012 +0100
+++ b/entity.py	Wed Feb 08 14:22:48 2012 +0100
@@ -481,7 +481,9 @@
             assert eschema.has_relation(attr, role), '%s %s not found on %s' % (attr, role, eschema)
             rschema = eschema.subjrels[attr] if role == 'subject' else eschema.objrels[attr]
             if not rschema.final and isinstance(value, (tuple, list, set, frozenset)):
-                if len(value) == 1:
+                if len(value) == 0:
+                    continue # avoid crash with empty IN clause
+                elif len(value) == 1:
                     value = iter(value).next()
                 else:
                     # prepare IN clause