~ubuntu-branches/ubuntu/hardy/moin/hardy-security

« back to all changes in this revision

Viewing changes to MoinMoin/macro/AttachList.py

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-05-14 15:55:15 UTC
  • mfrom: (0.4.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070514155515-apl4srcch40h9fcx
Tags: 1.5.7-3ubuntu1
* Merge from debian unstable, remaining changes:
  - 11000_show_traceback_toggle.patch: allow for 'show_traceback=0' in
    Moin configurations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
"""
2
2
    MoinMoin - AttachList Macro
3
3
 
4
 
    A macro to produce a list of attached pages
5
 
 
6
 
    Usage: [[AttachList]]
7
 
 
 
4
    A macro to produce a list of attached files
 
5
 
 
6
    Usage: [[AttachList([pagename,mime_type])]]
 
7
 
 
8
    If pagename isn't set, the current pagename is used.
 
9
    If mime_type isn't given, all files are listed.
 
10
    
8
11
    @copyright: 2004 Jacob Cohen, Nigel Metheringham
 
12
    @copyright: 2006 Reimar Bauer
9
13
    @license: GNU GPL, see COPYING for details.
10
14
"""
11
15
 
12
16
from MoinMoin.action.AttachFile import _build_filelist
13
17
 
14
18
def execute(macro, args):
 
19
    # defaults if we don't get anything better
15
20
    pagename = macro.formatter.page.page_name
 
21
    mime_type = '*'
16
22
    if args:
17
 
        pagename = args
18
 
    result = _build_filelist(macro.request, pagename, 0, 1);
19
 
    return result
 
23
        args = args.split(',')
 
24
        if args[0].strip():
 
25
            pagename = args[0].strip()
 
26
        if len(args) > 1 and args[1].strip():
 
27
            mime_type = args[1].strip()
 
28
    return _build_filelist(macro.request, pagename, 0, 1, mime_type=mime_type)
20
29