annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - add a quicklink to the user's quicklinks
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1913
diff changeset
5 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1913
diff changeset
6 2006 MoinMoin:ThomasWaldmann
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 @license: GNU GPL, see COPYING for details.
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 """
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 from MoinMoin.Page import Page
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 def execute(pagename, request):
1913
6769679b26f6 quicklink action: give msg if quicklink toggle failed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
12 """ Add the current wiki page to the user quicklinks """
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13 _ = request.getText
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 if not request.user.valid:
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
16 request.theme.add_msg(_("You must login to add a quicklink."), "error")
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 elif request.user.isQuickLinkedTo([pagename]):
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 if request.user.removeQuicklink(pagename):
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
19 request.theme.add_msg(_('Your quicklink to this page has been removed.'), "info")
1913
6769679b26f6 quicklink action: give msg if quicklink toggle failed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
20 else: # should not happen
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
21 request.theme.add_msg(_('Your quicklink to this page could not be removed.'), "error")
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 else:
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 if request.user.addQuicklink(pagename):
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
24 request.theme.add_msg(_('A quicklink to this page has been added for you.'), "info")
1913
6769679b26f6 quicklink action: give msg if quicklink toggle failed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
25 else: # should not happen
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
26 request.theme.add_msg(_('A quicklink to this page could not be added for you.'), "error")
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
28 Page(request, pagename).send_page()
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29