view MoinMoin/action/quicklink.py @ 2853:40e50e27ee50

test_text_html_text_moin_wiki: tests fixed
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 20 Sep 2007 20:56:41 +0200
parents bb2e053067fb
children ba14d391c2ba
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - add a quicklink to the user's quicklinks

    @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):
    """ Add the current wiki page to the user quicklinks """
    _ = request.getText
    msg = None

    if not request.user.valid:
        msg = _("You must login to add a quicklink.")
    elif request.user.isQuickLinkedTo([pagename]):
        if request.user.removeQuicklink(pagename):
            msg = _('Your quicklink to this page has been removed.')
        else: # should not happen
            msg = _('Your quicklink to this page could not be removed.')
    else:
        if request.user.addQuicklink(pagename):
            msg = _('A quicklink to this page has been added for you.')
        else: # should not happen
            msg = _('A quicklink to this page could not be added for you.')

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