Back to index

moin  1.9.0~rc2
quicklink.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - add a quicklink to the user's quicklinks
00004 
00005     @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
00006                 2006 MoinMoin:ThomasWaldmann
00007     @license: GNU GPL, see COPYING for details.
00008 """
00009 from MoinMoin.Page import Page
00010 
00011 def execute(pagename, request):
00012     """ Add the current wiki page to the user quicklinks """
00013     _ = request.getText
00014 
00015     if not request.user.valid:
00016         request.theme.add_msg(_("You must login to add a quicklink."), "error")
00017     elif not request.user.isQuickLinkedTo([pagename]):
00018         if request.user.addQuicklink(pagename):
00019             request.theme.add_msg(_('A quicklink to this page has been added for you.'), "info")
00020         else: # should not happen
00021             request.theme.add_msg(_('A quicklink to this page could not be added for you.'), "error")
00022     else:
00023         request.theme.add_msg(_('You already have a quicklink to this page.'))
00024 
00025     Page(request, pagename).send_page()
00026