view MoinMoin/events/ @ 3107:c6e39279f83b

refactor logging usage
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 22:59:30 +0100
parents 07cd2b5f0fb9
children a48929a5036c
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.

from MoinMoin.server import getLogger
logging = getLogger(__name__)

# use this to temporarily and selectively enable debug logging for this module

from MoinMoin import events as ev
from MoinMoin import wikidicts

def handle(event):
    # "changed" includes creation, deletion, renamed and copied
    if isinstance(event, ev.PageChangedEvent) or isinstance(event, ev.PageRenamedEvent) or isinstance(event, ev.PageCopiedEvent):
        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)
    del request.dicts
    gd = wikidicts.GroupDict(request)
    logging.debug("groupsdicts changed: scan_dicts finished")