1
# -*- coding: iso-8859-1 -*-
3
MoinMoin - wikidicts notification plugin for event system
5
When a Group or Dict page changes, we rescan them and recreate the cache.
7
@copyright: 2007 by MoinMoin:ThomasWaldmann
8
@license: GNU GPL, see COPYING for details.
11
from MoinMoin import log
12
logging = log.getLogger(__name__)
14
from MoinMoin import events as ev
15
from MoinMoin import wikidicts
18
# "changed" includes creation, deletion, renamed and copied
19
if (isinstance(event, ev.PageChangedEvent) or isinstance(event, ev.PageRenamedEvent) or
20
isinstance(event, ev.PageCopiedEvent) or isinstance(event, ev.TrivialPageChangedEvent)):
21
cfg = event.request.cfg
22
pagename = event.page.page_name
23
if cfg.cache.page_dict_regexact.search(pagename) or \
24
cfg.cache.page_group_regexact.search(pagename):
25
return handle_groupsdicts_changed(event)
28
def handle_groupsdicts_changed(event):
29
""" Handles events related to groups and dicts page changes:
30
Scans all pages matching the dict / group regex and pickles the
33
request = event.request
36
logging.debug("groupsdicts changed: %r, scan_dicts started", page.page_name)
38
gd = wikidicts.GroupDict(request)
40
logging.debug("groupsdicts changed: scan_dicts finished")