[form fields] option may be a 3-uple (3d element being dict containing widget options) stable cubicweb-version-3.9.6
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 13 Sep 2010 12:24:11 +0200
branchstable
changeset 6218 d37428222a63
parent 6217 e2aeb40d5983
child 6219 803c1019138e
child 6223 7d2cab567735
[form fields] option may be a 3-uple (3d element being dict containing widget options)
web/formfields.py
--- a/web/formfields.py	Mon Sep 13 11:00:22 2010 +0200
+++ b/web/formfields.py	Mon Sep 13 12:24:11 2010 +0200
@@ -410,11 +410,16 @@
         if self.sort:
             vocab = vocab_sort(vocab)
         # XXX pre 3.9 bw compat
-        for i, (label, value) in enumerate(vocab):
+        for i, option in enumerate(vocab):
+            # option may be a 2 or 3-uple (see Select widget _render method for
+            # explanation)
+            value = option[1]
             if value is not None and not isinstance(value, basestring):
                 warn('[3.9] %s: vocabulary value should be an unicode string'
                      % self, DeprecationWarning)
-                vocab[i] = (label, unicode(value))
+                option = list(option)
+                option[1] = unicode(value)
+                vocab[i] = option
         return vocab
 
     def format(self, form):