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.
--- 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