annotate MoinMoin/macro/Action.py @ 4468:fad2936d33a7 1.8.1

added dummy mig script for 1.8.1, bumped version number
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 24 Dec 2008 16:32:46 +0100
parents a739558ca3dc
children efed8b6bb030
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 # -*- coding: iso-8859-1 -*-
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
3 MoinMoin - Create an action link
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
5 @copyright: 2004, 2007 Johannes Berg <johannes@sipsolutions.net>
2200
e60ae8a23a49 macro.Action: getValidAction uses builtin actions too
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2199
diff changeset
6 2007 by MoinMoin:ReimarBauer
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
7 @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
8 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
9
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 from MoinMoin import wikiutil
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
11
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
12 Dependencies = ["language"]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
14
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
15 def _get_valid_actions(macro):
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
16 """ lists all valid actions """
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
17 from MoinMoin import action
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
18 # builtin
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
19 actions_builtin = action.names
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
20 # global
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
21 actions_global = ([x for x in action.modules
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
22 if not x in macro.request.cfg.actions_excluded])
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
23 # local
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
24 actions_local = ([x for x in wikiutil.wikiPlugins('action', macro.cfg)
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
25 if not x in macro.request.cfg.actions_excluded])
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
26
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
27 return actions_builtin + actions_global + actions_local
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
28
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
29 def macro_Action(macro, action=u'show', text=None, _kwargs=None):
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
30 _ = macro.request.getText
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
31 if text is None:
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
32 text = action
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
33 if not _kwargs:
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
34 _kwargs = {}
950
4eb66637ccd0 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 0
diff changeset
35
3123
5cb80bd604b4 refactored _() getText calls to match new api
Radomir Dopieralski <moindev@sheep.art.pl>
parents: 2594
diff changeset
36 text = _(text)
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
37 if action in _get_valid_actions(macro):
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
38 page = macro.formatter.page
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
39 _kwargs['action'] = action
3234
a739558ca3dc Page.url() default changed to relative=False
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3123
diff changeset
40 url = page.url(macro.request, querystr=_kwargs)
2579
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
41 return ''.join([
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
42 macro.formatter.url(1, url),
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
43 macro.formatter.text(text),
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
44 macro.formatter.url(0),
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
45 ])
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
46 else:
9f933413518b rewrite action macro. this breaks some pages that'll need to be fixed
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2553
diff changeset
47 return macro.formatter.text(text)