From a3715746cffe665468bbae1c8effe0b5b4243578 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Fri, 28 Feb 2014 08:13:29 +0100 Subject: [PATCH] =?UTF-8?q?[wiki/macro]=20Ajout=20d'une=20macro=20pour=20m?= =?UTF-8?q?ontrer=20toutes=20les=20pages=20qui=20ont=20des=20ACL=20sp?= =?UTF-8?q?=C3=A9cifi=C3=A9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wiki/macro/AllPagesWithACL.py | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 wiki/macro/AllPagesWithACL.py diff --git a/wiki/macro/AllPagesWithACL.py b/wiki/macro/AllPagesWithACL.py new file mode 100644 index 00000000..dd3c48f1 --- /dev/null +++ b/wiki/macro/AllPagesWithACL.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +""" + MoinMoin - AllPagesWithACL Macro + + @copyright: 2007 Alexander "Loki" Agibalov + @license: GNU GPL, see COPYING for details. + + changes: + 12.2007 - conversion to new syntax by Bolesław Kulbabiński +""" + +import os +import re +from MoinMoin.Page import Page +from MoinMoin import wikiutil + +def getAcl(request, pagename): + pg = Page(request, pagename) + pi = pg.get_pi() + ret = pi["acl"].getString() + if ret == '': + ret = "not defined" + return ret + + +def macro_AllPagesWithACL(macro, args): + html = "

All pages:
" + all = {} + pages = macro.request.rootpage.getPageList() +# pages = macro.request.rootpage.getPageList(filter = re.compile("^WikiSandBox").match) + html += "Total: %s pages

" % str(len(pages)) + + for pagename in pages: + all[Page(macro.request, pagename).link_to(macro.request)] = getAcl(macro.request, pagename) + + html += "" + all1 = sorted(all.items()) + for pg, ac in all1: + html += "" % pg + html += "" % ac + html += "
%s%s
" + + return macro.formatter.rawHTML(html) + + +def execute(macro, args): + try: + return wikiutil.invoke_extension_function( + macro.request, macro_AllPagesWithACL, args, [macro]) + except ValueError, err: + return macro.request.formatter.text( + "<>" % err.args[0]) +