view MoinMoin/action/ @ 2374:629dea07759f

do not parse single-quoted page names as quoted fixes bugs with ['text_html'] being a link
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 12 Jul 2007 14:40:06 +0200
parents bb2e053067fb
children 9817a90b6fde
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - subscribe to a page to get notified when it changes

    @copyright: 2000-2004 Juergen Hermann <>,
                2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
from MoinMoin.Page import Page

def execute(pagename, request):
    """ Subscribe or unsubscribe the user to pagename """
    _ = request.getText
    cfg = request.cfg
    msg = None

    if not
        msg = _("You are not allowed to subscribe to a page you can't read.")

    # Check if mail is enabled
    elif not cfg.mail_enabled:
        msg = _("This wiki is not enabled for mail processing.")

    # Suggest visitors to login
    elif not request.user.valid:
        msg = _("You must log in to use subscriptions.")

    # Suggest users without email to add their email address
    elif not
        msg = _("Add your email address in your UserPreferences to use subscriptions.")

    elif request.user.isSubscribedTo([pagename]):
        # Try to unsubscribe
        if request.user.unsubscribe(pagename):
            msg = _('Your subscription to this page has been removed.')
            msg = _("Can't remove regular expression subscription!") + u' ' + \
                  _("Edit the subscription regular expressions in your "

        # Try to subscribe
        if request.user.subscribe(pagename):
            msg = _('You have been subscribed to this page.')
        else: # should not happen
            msg = _('You could not get subscribed to this page.')

    Page(request, pagename).send_page(msg=msg)