Mercurial > moin > 1.9
view MoinMoin/macro/Action.py @ 2999:e94b940f3a84
add a comment about listen backlog to moin.fcg (port from 1.6)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 06 Jan 2008 17:32:33 +0100 |
parents | dae34d586476 |
children | 5cb80bd604b4 |
line wrap: on
line source
# -*- coding: iso-8859-1 -*- """ MoinMoin - Create an action link @copyright: 2004, 2007 Johannes Berg <johannes@sipsolutions.net> 2007 by MoinMoin:ReimarBauer @license: GNU GPL, see COPYING for details. """ from MoinMoin import wikiutil Dependencies = ["language"] def _get_valid_actions(macro): """ lists all valid actions """ from MoinMoin import action # builtin actions_builtin = action.names # global actions_global = ([x for x in action.modules if not x in macro.request.cfg.actions_excluded]) # local actions_local = ([x for x in wikiutil.wikiPlugins('action', macro.cfg) if not x in macro.request.cfg.actions_excluded]) return actions_builtin + actions_global + actions_local def macro_Action(macro, action=u'show', text=None, _kwargs=None): _ = macro.request.getText if text is None: text = action if not _kwargs: _kwargs = {} text = _(text, formatted=False) if action in _get_valid_actions(macro): page = macro.formatter.page _kwargs['action'] = action url = page.url(macro.request, querystr=_kwargs, relative=False) return ''.join([ macro.formatter.url(1, url), macro.formatter.text(text), macro.formatter.url(0), ]) else: return macro.formatter.text(text)