view MoinMoin/action/unsubscribe.py @ 3211:8a1f1a9dd37f

fix. misc problems found by pydev (unused/double imports, unused attributes, ...)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 07 Mar 2008 09:13:46 +0100
parents a1322262398a
children 928a45b60bb3
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
    msg = None

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

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