web/formfields.py
changeset 5270 6297d5265572
parent 5238 31c12863fd9d
child 5385 b6e250dd7a7d
equal deleted inserted replaced
5251:b675edd05c19 5270:6297d5265572
   587             value = posted[self.input_name(form)]
   587             value = posted[self.input_name(form)]
   588         except KeyError:
   588         except KeyError:
   589             # raise UnmodifiedField instead of returning None, since the later
   589             # raise UnmodifiedField instead of returning None, since the later
   590             # will try to remove already attached file if any
   590             # will try to remove already attached file if any
   591             raise UnmodifiedField()
   591             raise UnmodifiedField()
       
   592         # value is a 2-uple (filename, stream)
   592         filename, stream = value
   593         filename, stream = value
   593         # value is a  3-uple (filename, mimetype, stream)
   594         # XXX avoid in memory loading of posted files. Requires Binary handling changes...
   594         value = Binary(stream.read())
   595         value = Binary(stream.read())
   595         if not value.getvalue(): # usually an unexistant file
   596         if not value.getvalue(): # usually an unexistant file
   596             value = None
   597             value = None
   597         else:
   598         else:
   598             # set filename on the Binary instance, may be used later in hooks
   599             # set filename on the Binary instance, may be used later in hooks