accepts single values as create_entity stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Oct 2009 13:00:31 +0200
branchstable
changeset 3746 74192424b2c8
parent 3745 006c81b94ec5
child 3747 9165bd634f90
accepts single values as create_entity
entity.py
--- a/entity.py	Tue Oct 20 12:48:43 2009 +0200
+++ b/entity.py	Tue Oct 20 13:00:31 2009 +0200
@@ -886,6 +886,8 @@
                 restr = 'Y %s X' % attr[len('reverse_'):]
             else:
                 restr = 'X %s Y' % attr
+            if not isinstance(values, (tuple, list, set, frozenset)):
+                values = (values,)
             execute('SET %s WHERE X eid %%(x)s, Y eid IN (%s)' % (
                 restr, ','.join(str(r.eid) for r in values)),
                     {'x': self.eid}, 'x')