Commit a4d264eb authored by Vincent Le gallic's avatar Vincent Le gallic

[wiki/macro] Nouvelle macro pour voir qui est inscrit avec une typo dans les groupes.

parent f44962cb
# -*- coding: utf-8 -*-
MoinMoin - LostSoulsInGroups macro
List all items in custom groups that do not have user accounts
(either haven't registered yet or have been deleted or there's a typo)
@copyright: 2007 Alexander "Loki" Agibalov
@license: GNU GPL, see COPYING for details.
12.2007 - conversion to new syntax by Bolesław Kulbabiński
from MoinMoin import wikiutil, user
from MoinMoin.Page import Page
from MoinMoin.PageEditor import PageEditor
import re, sys
def macro_LostSoulsInGroups(macro, args):
request = macro.request
_ = macro.request.getText
sRet = "<p><b>Items in custom groups (Users in custom groups who don't have user accounts)</b></p>"
sRet = sRet + "<table>"
userlist = []
lostsouls = {}
for uid in user.getUserList(request):
userlist.append(user.User(request, uid).name)
isgroup =
grouppages = request.rootpage.getPageList(user='', filter=isgroup)
srch = re.compile("^ \* [^ ]*", re.M)
for pg in grouppages:
pged = PageEditor(request, pg)
pagelines = pged.getlines()
for lin in pagelines:
srchS = srch.match(lin)
if srchS:
st =
st = st[3:]
usr = userlist.index(st)
except ValueError:
if lostsouls.has_key(pg):
temp_lst = lostsouls[pg]
lostsouls[pg] = temp_lst
lostsouls[pg] = [st]
for k, v in lostsouls.iteritems():
st = '<tr><td>%s</td><td>%s</td></tr>' % (Page(request, k).link_to(request), ", ".join(v))
sRet = sRet + st
sRet = sRet + "</table>"
return macro.formatter.rawHTML(sRet)
def execute(macro, args):
return wikiutil.invoke_extension_function(
macro.request, macro_LostSoulsInGroups, args, [macro])
except ValueError, err:
return macro.request.formatter.text(
"<<LostSoulsInGroups: %s>>" % err.args[0])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment