view MoinMoin/action/ @ 1661:2fe0ea7022f1

fix typos in subscribe action msgs
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 01 Nov 2006 20:58:47 +0100
parents 289f93f2fd61
children ed44b93599b5
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - subscribe to a page to get notified when it changes

    @copyright: 2000-2004 by Jürgen Hermann <>,
                2006 by 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
    TODO: what if subscribe failed? no message is displayed.
    _ = 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.')

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