diff MoinMoin/action/AttachFile.py @ 1653:5b15b6e010cf

AttachList can list files of given mimetype now (ported from 1.5)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 31 Oct 2006 22:11:29 +0100
parents a41c60e53ddd
children 3338af3c3867
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Tue Oct 31 22:06:16 2006 +0100
+++ b/MoinMoin/action/AttachFile.py	Tue Oct 31 22:11:29 2006 +0100
@@ -251,13 +251,16 @@
     return (None, None)
 
 
-def _build_filelist(request, pagename, showheader, readonly):
+def _build_filelist(request, pagename, showheader, readonly, mime_type='*'):
     _ = request.getText
 
     # access directory
     attach_dir = getAttachDir(request, pagename)
     files = _get_files(request, pagename)
 
+    if mime_type != '*':
+        files = [fname for fname in files if mime_type == mimetypes.guess_type(fname)[0]]
+
     str = ""
     if files:
         if showheader: