annotate MoinMoin/macro/AttachList.py @ 5952:f6a74810da73

updated CHANGES
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Mar 2013 15:28:04 +0100
parents 378bfb1d0eec
children
rev   line source
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 MoinMoin - AttachList Macro
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
3
1653
5b15b6e010cf AttachList can list files of given mimetype now (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 950
diff changeset
4 A macro to produce a list of attached files
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
5
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1994
diff changeset
6 Usage: <<AttachList([pagename,mime_type])>>
1653
5b15b6e010cf AttachList can list files of given mimetype now (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 950
diff changeset
7
5b15b6e010cf AttachList can list files of given mimetype now (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 950
diff changeset
8 If pagename isn't set, the current pagename is used.
5b15b6e010cf AttachList can list files of given mimetype now (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 950
diff changeset
9 If mime_type isn't given, all files are listed.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1653
diff changeset
11 @copyright: 2004 Jacob Cohen, Nigel Metheringham,
5948
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
12 2006-2013 MoinMoin:ReimarBauer
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13 @license: GNU GPL, see COPYING for details.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
14 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
15
5948
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
16 import re
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
17
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
18 from MoinMoin.action.AttachFile import _build_filelist
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
19
5948
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
20 def macro_AttachList(macro, pagename=None, mime_type=u'*', search_term=u'.+'):
1653
5b15b6e010cf AttachList can list files of given mimetype now (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 950
diff changeset
21 # defaults if we don't get anything better
3241
03b3c6fd70e3 changed to new arg parser
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2725
diff changeset
22 if not pagename:
03b3c6fd70e3 changed to new arg parser
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2725
diff changeset
23 pagename = macro.formatter.page.page_name
5948
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
24 filterfn = re.compile(search_term, re.U).search
378bfb1d0eec AttachList: introduced search_term parameter (optional) for listing attachments by a regular expression
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3241
diff changeset
25 return _build_filelist(macro.request, pagename, 0, 1, mime_type=mime_type, filterfn=filterfn)
3241
03b3c6fd70e3 changed to new arg parser
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2725
diff changeset
26
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
27