diff roundup/cgi/client.py @ 1986:910b39f8c5b8

use the upload-supplied content-type if there is one
author Richard Jones <richard@users.sourceforge.net>
date Tue, 20 Jan 2004 03:58:38 +0000
parents f96592a7c357
children d3df62136c30
line wrap: on
line diff
--- a/roundup/cgi/client.py	Tue Jan 20 03:57:26 2004 +0000
+++ b/roundup/cgi/client.py	Tue Jan 20 03:58:38 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: client.py,v 1.152 2004-01-19 23:56:07 richard Exp $
+# $Id: client.py,v 1.153 2004-01-20 03:58:38 richard Exp $
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
@@ -1778,8 +1778,11 @@
                                 props['name'] = fn
                             # use this info as the type/filename properties
                             if propdef.has_key('type'):
-                                props['type'] = mimetypes.guess_type(fn)[0]
-                                if not props['type']:
+                                if hasattr(value, 'type'):
+                                    props['type'] = value.type
+                                elif mimetypes.guess_type(fn)[0]:
+                                    props['type'] = mimetypes.guess_type(fn)[0]
+                                else:
                                     props['type'] = "application/octet-stream"
                             # finally, read the content RAW
                             value = value.value

Roundup Issue Tracker: http://roundup-tracker.org/