diff MoinMoin/action/AttachFile.py @ 5948:378bfb1d0eec

AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 08 Mar 2013 08:39:57 +0100
parents 3c27131a3c52
children 3460b27e7f3e
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Thu Mar 07 02:06:56 2013 +0100
+++ b/MoinMoin/action/AttachFile.py	Fri Mar 08 08:39:57 2013 +0100
@@ -22,7 +22,7 @@
                 2001-2004 by Juergen Hermann <jh@web.de>,
                 2005 MoinMoin:AlexanderSchremmer,
                 2005 DiegoOngaro at ETSZONE (diego@etszone.com),
-                2005-2007 MoinMoin:ReimarBauer,
+                2005-2013 MoinMoin:ReimarBauer,
                 2007-2008 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
@@ -310,7 +310,7 @@
     return (pagename, None, None)
 
 
-def _build_filelist(request, pagename, showheader, readonly, mime_type='*'):
+def _build_filelist(request, pagename, showheader, readonly, mime_type='*', filterfn=None):
     _ = request.getText
     fmt = request.html_formatter
 
@@ -320,6 +320,8 @@
 
     if mime_type != '*':
         files = [fname for fname in files if mime_type == mimetypes.guess_type(fname)[0]]
+    if filterfn is not None:
+        files = [fname for fname in files if filterfn(fname)]
 
     html = []
     if files: