entity.py
changeset 8216 99ff746e8de8
parent 8190 2a3c1b787688
parent 8199 fb5c0e60a615
child 8307 8be58694f416
--- a/entity.py	Fri Feb 10 16:31:39 2012 +0100
+++ b/entity.py	Fri Feb 10 16:53:52 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