Handle new way of reporting unmodified FileFields stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Thu, 06 May 2010 16:23:39 +0000
branchstable
changeset 5497 96fd339f7917
parent 5496 d1b6db4d7b3f
child 5498 eab5540d96eb
child 5499 2a5cc708c2a0
Handle new way of reporting unmodified FileFields when a FileField has not been modified, value is an empty string. Handle this is raise UnmodifiedField accordingly.
web/formfields.py
--- a/web/formfields.py	Thu May 06 14:48:44 2010 +0200
+++ b/web/formfields.py	Thu May 06 16:23:39 2010 +0000
@@ -724,7 +724,10 @@
             # will try to remove already attached file if any
             raise UnmodifiedField()
         # value is a 2-uple (filename, stream)
-        filename, stream = value
+        try:
+            filename, stream = value
+        except ValueError:
+            raise UnmodifiedField()
         # XXX avoid in memory loading of posted files. Requires Binary handling changes...
         value = Binary(stream.read())
         if not value.getvalue(): # usually an unexistant file