view MoinMoin/action/unsubscribe.py @ 3085:fdb68a8f92da

fix wrong pagename when creating new pages on Mac OS X (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 00:28:53 +0100
parents f48d46b39364
children a1322262398a
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - unsubscribe from notifications to a page.

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

def execute(pagename, request):
    """ Unsubscribe the user from pagename """
    _ = request.getText
    cfg = request.cfg
    msg = None

    if request.user.isSubscribedTo([pagename]):
        # Try to unsubscribe
        if request.user.unsubscribe(pagename):
            msg = _('Your subscription to this page has been removed.', formatted=False)
        else:
            msg = _("Can't remove regular expression subscription!", formatted=False) + u' ' + \
                  _("Edit the subscription regular expressions in your "
                    "UserPreferences.", formatted=True)
    else:
        # The user is not subscribed
        msg = _('You need to be subscribed to unsubscribe.', formatted=False)

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