web/formfields.py
changeset 9147 01124cfd4b1f
parent 8695 358d8bed9626
child 9205 ea32e964fbf8
equal deleted inserted replaced
9146:9b58a6406a64 9147:01124cfd4b1f
   753             value = posted[self.input_name(form)]
   753             value = posted[self.input_name(form)]
   754         except KeyError:
   754         except KeyError:
   755             # raise UnmodifiedField instead of returning None, since the later
   755             # raise UnmodifiedField instead of returning None, since the later
   756             # will try to remove already attached file if any
   756             # will try to remove already attached file if any
   757             raise UnmodifiedField()
   757             raise UnmodifiedField()
   758         # value is a 2-uple (filename, stream)
   758         # value is a 2-uple (filename, stream) or a list of such
       
   759         # tuples (multiple files)
   759         try:
   760         try:
       
   761             if isinstance(value, list):
       
   762                 value = value[0]
       
   763                 form.warning('mutiple files provided, however '
       
   764                              'only the first will be picked')
   760             filename, stream = value
   765             filename, stream = value
   761         except ValueError:
   766         except ValueError:
   762             raise UnmodifiedField()
   767             raise UnmodifiedField()
   763         # XXX avoid in memory loading of posted files. Requires Binary handling changes...
   768         # XXX avoid in memory loading of posted files. Requires Binary handling changes...
   764         value = Binary(stream.read())
   769         value = Binary(stream.read())