diff MoinMoin/action/AttachFile.py @ 1967:3bc30cdc4555

AttachFile, EmbedObject: code optimisation to use wikiutil.MimeType and refactoring of EmbedObject
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 08 Apr 2007 21:21:30 +0000
parents 8ab85e3711dc
children eb5328be394e 3475126f78c6
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Apr 08 19:31:12 2007 +0000
+++ b/MoinMoin/action/AttachFile.py	Sun Apr 08 21:21:30 2007 +0000
@@ -1011,8 +1011,7 @@
 
     # use EmbedObject to view valid mime types 
     from MoinMoin.macro.EmbedObject import EmbedObject
-    mime_type, enc = mimetypes.guess_type(filename)
-    if mime_type is None:
+    if mt is None:
         request.write('<p>' + _("Unknown file type, cannot display this attachment inline.") + '</p>')
         request.write('For using an external program follow this link <a href="%s">%s</a>' % (
              getAttachUrl(pagename, filename, request, escaped=1), wikiutil.escape(filename)))
@@ -1020,7 +1019,7 @@
 
     url = getAttachUrl(pagename, filename, request, escaped=1)
 
-    request.write(request.formatter.rawHTML(EmbedObject.embed(EmbedObject(macro, wikiutil.escape(filename)), mime_type, url)))
+    request.write(request.formatter.rawHTML(EmbedObject.embed(EmbedObject(macro, wikiutil.escape(filename)), mt, url)))
     return