annotate MoinMoin/action/quickunlink.py @ 4072:8bbb028087f1

merge changes from moin/1.7
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 07 Sep 2008 16:22:59 +0200
parents a1322262398a
children f414aece63e0
rev   line source
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:
diff changeset
1 # -*- coding: iso-8859-1 -*-
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:
diff changeset
2 """
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:
diff changeset
3 MoinMoin - remove a quicklink from the user's quicklinks
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:
diff changeset
4
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:
diff changeset
5 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
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:
diff changeset
6 2006 MoinMoin:ThomasWaldmann
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:
diff changeset
7 @license: GNU GPL, see COPYING for details.
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:
diff changeset
8 """
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:
diff changeset
9 from MoinMoin.Page import Page
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:
diff changeset
10
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:
diff changeset
11 def execute(pagename, request):
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:
diff changeset
12 """ Remove the current wiki page from the user's quicklinks """
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:
diff changeset
13 _ = request.getText
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:
diff changeset
14 msg = None
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:
diff changeset
15
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:
diff changeset
16 if not request.user.valid:
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3059
diff changeset
17 msg = _("You must login to remove a quicklink.")
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:
diff changeset
18 elif request.user.isQuickLinkedTo([pagename]):
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:
diff changeset
19 if request.user.removeQuicklink(pagename):
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3059
diff changeset
20 msg = _('Your quicklink to this page has been removed.')
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:
diff changeset
21 else: # should not happen
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3059
diff changeset
22 msg = _('Your quicklink to this page could not be removed.')
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:
diff changeset
23 else:
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3059
diff changeset
24 msg = _('You need to have a quicklink to this page to remove it.')
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:
diff changeset
25
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:
diff changeset
26 Page(request, pagename).send_page(msg=msg)