diff MoinMoin/action/AttachFile.py @ 789:a1359eaee20e

xapian search: some fixes, move mimetype stuff to wikiutil, add opendocument mimetypes, add opendocument filter modules
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 01 May 2006 16:43:28 +0200
parents 77526f8f3ecf
children 28de47f4ff1a
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Apr 30 18:12:28 2006 +0200
+++ b/MoinMoin/action/AttachFile.py	Mon May 01 16:43:28 2006 +0200
@@ -26,7 +26,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, mimetypes, time, zipfile
+import os, time, zipfile
 from MoinMoin import config, user, util, wikiutil, packages
 from MoinMoin.Page import Page
 from MoinMoin.util import MoinMoinNoFooter, filesys
@@ -544,15 +544,15 @@
     target = wikiutil.taintfilename(target)
 
     # set mimetype from extension, or from given mimetype
-    #type, encoding = mimetypes.guess_type(target)
+    #type, encoding = wikiutil.guess_type(target)
     #if not type:
     #    ext = None
     #    if request.form.has_key('mime'):
-    #        ext = mimetypes.guess_extension(request.form['mime'][0])
+    #        ext = wikiutil.guess_extension(request.form['mime'][0])
     #    if not ext:
-    #        type, encoding = mimetypes.guess_type(filename)
+    #        type, encoding = wikiutil.guess_type(filename)
     #        if type:
-    #            ext = mimetypes.guess_extension(type)
+    #            ext = wikiutil.guess_extension(type)
     #        else:
     #            ext = ''
     #    target = target + ext
@@ -634,7 +634,7 @@
     if not filename: return # error msg already sent in _access_file
 
     # get mimetype
-    type, enc = mimetypes.guess_type(filename)
+    type, enc = wikiutil.guess_type(filename)
     if not type:
         type = "application/octet-stream"
 
@@ -766,7 +766,7 @@
 
     request.write('<h2>' + _("Attachment '%(filename)s'") % {'filename': filename} + '</h2>')
 
-    type, enc = mimetypes.guess_type(filename)
+    type, enc = wikiutil.guess_type(filename)
     if type:
         if type[:5] == 'image':
             timestamp = htdocs_access(request) and "?%s" % time.time() or ''