diff MoinMoin/items/__init__.py @ 173:89f50aed143f

move mimetype related code from wikiutil to util.mimetype
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 06 Apr 2011 16:46:54 +0200
parents 1481cbc12553
children e8f61cbd661b
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Wed Apr 06 03:49:00 2011 +0200
+++ b/MoinMoin/items/__init__.py	Wed Apr 06 16:46:54 2011 +0200
@@ -20,8 +20,10 @@
 import zipfile
 import tempfile
 from StringIO import StringIO
+
 from MoinMoin.security.textcha import TextCha, TextChaizedForm, TextChaValid
 from MoinMoin.util.forms import make_generator
+from MoinMoin.util.mimetype import MimeType
 
 try:
     import PIL
@@ -371,7 +373,7 @@
         if data_file and data_file.filename:
             # user selected a file to upload
             data = data_file.stream
-            mimetype = wikiutil.MimeType(filename=data_file.filename).mime_type()
+            mimetype = MimeType(filename=data_file.filename).mime_type()
         else:
             # take text from textarea
             data = request.form.get('data_text', '')
@@ -654,7 +656,7 @@
         filename = None
         if member: # content = file contained within a archive item revision
             path, filename = os.path.split(member)
-            mt = wikiutil.MimeType(filename=filename)
+            mt = MimeType(filename=filename)
             content_disposition = mt.content_disposition(app.cfg)
             content_type = mt.content_type()
             content_length = None
@@ -665,7 +667,7 @@
                 mimestr = rev[MIMETYPE]
             except KeyError:
                 mimestr = mimetypes.guess_type(rev.item.name)[0]
-            mt = wikiutil.MimeType(mimestr=mimestr)
+            mt = MimeType(mimestr=mimestr)
             content_disposition = mt.content_disposition(app.cfg)
             content_type = mt.content_type()
             content_length = rev[SIZE]
@@ -1173,7 +1175,7 @@
         tree.write(file_to_send, namespaces=output_namespaces)
 
         # We determine the different parameters for the reply
-        mt = wikiutil.MimeType(mimestr='application/docbook+xml')
+        mt = MimeType(mimestr='application/docbook+xml')
         content_disposition = mt.content_disposition(app.cfg)
         content_type = mt.content_type()
         # After creation of the StringIO, we are at the end of the file