annotate MoinMoin/action/unsubscribe.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 74f42592c7a0
children f414aece63e0
rev   line source
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
2 """
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
3 MoinMoin - unsubscribe from notifications to a page.
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
4
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (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>,
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
6 2006 MoinMoin:ThomasWaldmann
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (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.
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
8 """
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (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
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
10
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
11 def execute(pagename, request):
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
12 """ Unsubscribe the user from pagename """
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
13 _ = request.getText
3521
c9f5e4f9a76e action bookmark, subscribe, unsubscribe, userprefs: check for valid.user
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3333
diff changeset
14 if not request.user.valid:
3523
74f42592c7a0 action bookmark, subscribe, unsubscribe, userprefs: moved actname under the if ...
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3521
diff changeset
15 actname = __name__.split('.')[-1]
3521
c9f5e4f9a76e action bookmark, subscribe, unsubscribe, userprefs: check for valid.user
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3333
diff changeset
16 request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
c9f5e4f9a76e action bookmark, subscribe, unsubscribe, userprefs: check for valid.user
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3333
diff changeset
17 return Page(request, pagename).send_page()
c9f5e4f9a76e action bookmark, subscribe, unsubscribe, userprefs: check for valid.user
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3333
diff changeset
18
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
19 msg = None
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
20
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
21 if request.user.isSubscribedTo([pagename]):
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
22 # Try to unsubscribe
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
23 if request.user.unsubscribe(pagename):
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3058
diff changeset
24 msg = _('Your subscription to this page has been removed.')
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
25 else:
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3058
diff changeset
26 msg = _("Can't remove regular expression subscription!") + u' ' + \
3333
928a45b60bb3 remove remaining mentions of "UserPreferences", add to CHANGES
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3211
diff changeset
27 _("Edit the subscription regular expressions in your settings.")
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
28 else:
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
29 # The user is not subscribed
3122
a1322262398a refactored _() getText calls to match new api
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3058
diff changeset
30 msg = _('You need to be subscribed to unsubscribe.')
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
31
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
32 Page(request, pagename).send_page(msg=msg)
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
33