[web/formwidgets] check on list (entity.related_cache swapped from tuple to list a while ago without known reasons), do not unicode wrap the eids stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 03 Jun 2010 16:37:01 +0200
branchstable
changeset 5661 84ef08bbda3c
parent 5660 97343804414b
child 5662 785837baabba
[web/formwidgets] check on list (entity.related_cache swapped from tuple to list a while ago without known reasons), do not unicode wrap the eids
web/formfields.py
--- a/web/formfields.py	Thu Jun 03 15:13:41 2010 +0200
+++ b/web/formfields.py	Thu Jun 03 16:37:01 2010 +0200
@@ -433,9 +433,11 @@
             # attribute or relation
             return True
         # if it's a non final relation, we need the eids
-        if isinstance(previous_value, tuple):
+        # XXX underlying regression: getattr(ent, 'foo') used to return
+        #     a tuple, now we get a list
+        if isinstance(previous_value, (list, tuple)):
             # widget should return a set of untyped eids
-            previous_value = set(unicode(e.eid) for e in previous_value)
+            previous_value = set(e.eid for e in previous_value)
         try:
             new_value = self.process_form_value(form)
         except ProcessFormError: