annotate MoinMoin/action/quicklink.py @ 6111:1fdd537e9d83

SubProcess: reimplement exec_cmd subclassing Popen and overriding some methods isn't pretty. the code we have was written for py 2.4 or so and the py 2.7 Popen looked quite different. this way with the timer should be less problematic.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 06 Sep 2016 04:39:28 +0200
parents a1322262398a
children
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")
3059
036fc4dce2ee fix quicklink action using same URL for link/unlink (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2966
diff changeset
17 elif not request.user.isQuickLinkedTo([pagename]):
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 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
19 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
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(_('A quicklink to this page could not be added for you.'), "error")
3059
036fc4dce2ee fix quicklink action using same URL for link/unlink (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2966
diff changeset
22 else:
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3059
diff changeset
23 request.theme.add_msg(_('You already have a quicklink to this page.'))
1106
62f28a891ede move quicklink code to action/quicklink.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24
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
25 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
26