comparison MoinMoin/action/quicklink.py @ 2966:ba14d391c2ba

Refactor all modules to use the new add_msg interface in 1.7 (done by Frederico Lorenzi). Should not be backported to 1.6 but instead the separate patch from http://code.google.com/p/google-highly-open-participation-moinmoin/issues/detail?id=51 should be used.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sun, 23 Dec 2007 23:52:43 +0100
parents bb2e053067fb
children 036fc4dce2ee
comparison
equal deleted inserted replaced
2965:4d60ea3a4ca7 2966:ba14d391c2ba
9 from MoinMoin.Page import Page 9 from MoinMoin.Page import Page
10 10
11 def execute(pagename, request): 11 def execute(pagename, request):
12 """ Add the current wiki page to the user quicklinks """ 12 """ Add the current wiki page to the user quicklinks """
13 _ = request.getText 13 _ = request.getText
14 msg = None
15 14
16 if not request.user.valid: 15 if not request.user.valid:
17 msg = _("You must login to add a quicklink.") 16 request.theme.add_msg(_("You must login to add a quicklink."), "error")
18 elif request.user.isQuickLinkedTo([pagename]): 17 elif request.user.isQuickLinkedTo([pagename]):
19 if request.user.removeQuicklink(pagename): 18 if request.user.removeQuicklink(pagename):
20 msg = _('Your quicklink to this page has been removed.') 19 request.theme.add_msg(_('Your quicklink to this page has been removed.'), "info")
21 else: # should not happen 20 else: # should not happen
22 msg = _('Your quicklink to this page could not be removed.') 21 request.theme.add_msg(_('Your quicklink to this page could not be removed.'), "error")
23 else: 22 else:
24 if request.user.addQuicklink(pagename): 23 if request.user.addQuicklink(pagename):
25 msg = _('A quicklink to this page has been added for you.') 24 request.theme.add_msg(_('A quicklink to this page has been added for you.'), "info")
26 else: # should not happen 25 else: # should not happen
27 msg = _('A quicklink to this page could not be added for you.') 26 request.theme.add_msg(_('A quicklink to this page could not be added for you.'), "error")
28 27
29 Page(request, pagename).send_page(msg=msg) 28 Page(request, pagename).send_page()
30 29