view MoinMoin/events/ @ 2385:53fbdf5899ff

Use the event handling framework to (re)generate xapian indexes.
author Karol 'grzywacz' Nowak <>
date Sat, 14 Jul 2007 18:42:12 +0200
parents 01f05e74aa9c
children 9fdc81419de7
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - wikidicts notification plugin for event system

    When a Group or Dict page changes, we rescan them and recreate the cache.

    @copyright: 2007 by MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
import logging

from MoinMoin import events as ev
from MoinMoin import wikidicts

def handle(event):
    if isinstance(event, ev.PageChangedEvent): # "changed" includes creation and deletion
        cfg = event.request.cfg
        pagename =
        if or \
            return handle_groupsdicts_changed(event)

def handle_groupsdicts_changed(event):
    """ Handles events related to groups and dicts page changes:
        Scans all pages matching the dict / group regex and pickles the
        data to disk.
    request = event.request
    page =

    logging.debug("groupsdicts changed: %r, scan_dicts started", page.page_name)
    gd = wikidicts.GroupDict(request)
    logging.debug("groupsdicts changed: scan_dicts finished")