crecord introduced junk...
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 21 Dec 2009 20:27:14 +0100
changeset 4170 c325c62cec8e
parent 4169 341d19ef7b7c
child 4171 f1b9f0ed1253
crecord introduced junk...
web/formfields.py
--- a/web/formfields.py	Mon Dec 21 20:26:52 2009 +0100
+++ b/web/formfields.py	Mon Dec 21 20:27:14 2009 +0100
@@ -288,7 +288,9 @@
                      'the form instance as argument', DeprecationWarning)
                 vocab = self.choices(req=form._cw)
         else:
-            vocab = form.form_field_vocabulary(self)
+            vocab = self.choices
+        if vocab and not isinstance(vocab[0], (list, tuple)):
+            vocab = [(x, x) for x in vocab]
         if self.internationalizable:
             # the short-cirtcuit 'and' boolean operator is used here to permit
             # a valid empty string in vocabulary without attempting to translate
@@ -550,7 +552,7 @@
             value = posted.get(self.input_name(form))
         # no need to check value when nor explicit detach nor new file
         # submitted, since it will think the attribute is not modified
-        elif value:
+        if value:
             filename, _, stream = value
             # value is a  3-uple (filename, mimetype, stream)
             value = Binary(stream.read())