web/views/editcontroller.py
branchtls-sprint
changeset 1765 a25c7c73c8f6
parent 1753 ba01605cdd9a
child 1798 cc86fe8efaaa
equal deleted inserted replaced
1764:73dc7ad124aa 1765:a25c7c73c8f6
   205             # submitted, since it will think the attribute is not modified
   205             # submitted, since it will think the attribute is not modified
   206             elif isinstance(value, unicode):
   206             elif isinstance(value, unicode):
   207                 # file modified using a text widget
   207                 # file modified using a text widget
   208                 encoding = entity.attr_metadata(attr, 'encoding')
   208                 encoding = entity.attr_metadata(attr, 'encoding')
   209                 value = Binary(value.encode(encoding))
   209                 value = Binary(value.encode(encoding))
   210             else:
   210             elif value:
   211                 # value is a  3-uple (filename, mimetype, stream)
   211                 # value is a  3-uple (filename, mimetype, stream)
   212                 val = Binary(value[2].read())
   212                 val = Binary(value[2].read())
   213                 if not val.getvalue(): # usually an unexistant file
   213                 if not val.getvalue(): # usually an unexistant file
   214                     value = None
   214                     value = None
   215                 else:
   215                 else: