annotate MoinMoin/action/unsubscribe.py @ 6133:a6283e189869 tip

fixup: remove nonexisting passlib.utils._blowfish this was removed by the passlib 1.7.1 upgrade.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 01 Jun 2017 18:10:19 +0200
parents a306904a3620
children
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 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
20 # 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
21 if request.user.unsubscribe(pagename):
4633
a306904a3620 unsubscribe action: add msg types so icons get displayed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4421
diff changeset
22 request.theme.add_msg(_('Your subscription to this page has been removed.'), "info")
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (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: 3058
diff changeset
24 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
25 _("Edit the subscription regular expressions in your settings.")
4633
a306904a3620 unsubscribe action: add msg types so icons get displayed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4421
diff changeset
26 request.theme.add_msg(msg, "error")
3058
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
27 else:
f48d46b39364 fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
28 # The user is not subscribed
4633
a306904a3620 unsubscribe action: add msg types so icons get displayed
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4421
diff changeset
29 request.theme.add_msg(_('You need to be subscribed to unsubscribe.'), "info")
4421
f414aece63e0 send_page has no msg param any more, use theme.add_msg
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3523
diff changeset
30 Page(request, pagename).send_page()
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