web/views/editcontroller.py
branchtls-sprint
changeset 1361 c558a88bb85d
parent 1360 13ae1121835e
child 1753 ba01605cdd9a
--- a/web/views/editcontroller.py	Wed Apr 15 14:41:06 2009 +0200
+++ b/web/views/editcontroller.py	Wed Apr 15 14:41:38 2009 +0200
@@ -208,17 +208,20 @@
                 encoding = entity.attr_metadata(attr, 'encoding')
                 value = Binary(value.encode(encoding))
             else:
-                # (filename, mimetype, stream)
+                # value is a  3-uple (filename, mimetype, stream)
                 val = Binary(value[2].read())
                 if not val.getvalue(): # usually an unexistant file
                     value = None
                 else:
                     val.filename = value[0]
-                    if entity.e_schema.has_metadata(attr, 'format'):
-                        key = '%s_format' % attr
-                        formparams[key] = value[1]
-                        self.relations.append('X %s_format %%(%s)s'
-                                              % (attr, key))
+                    # ignore browser submitted MIME type since it may be buggy
+                    # XXX add a config option to tell if we should consider it
+                    # or not?
+                    #if entity.e_schema.has_metadata(attr, 'format'):
+                    #    key = '%s_format' % attr
+                    #    formparams[key] = value[1]
+                    #    self.relations.append('X %s_format %%(%s)s'
+                    #                          % (attr, key))
                     # XXX suppose a File compatible schema
                     if entity.e_schema.has_subject_relation('name') \
                            and not formparams.get('name'):