diff MoinMoin/action/unsubscribe.py @ 3058:f48d46b39364

fix MoinMoinBugs/SubscribeAndUnsubscribeShareSameUrl (thanks to Federico Lorenzi) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 21 Feb 2008 20:37:32 +0100
parents
children a1322262398a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/action/unsubscribe.py	Thu Feb 21 20:37:32 2008 +0100
@@ -0,0 +1,30 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - unsubscribe from notifications to a page.
+
+    @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
+                2006 MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+from MoinMoin.Page import Page
+
+def execute(pagename, request):
+    """ Unsubscribe the user from pagename """
+    _ = request.getText
+    cfg = request.cfg
+    msg = None
+
+    if request.user.isSubscribedTo([pagename]):
+        # Try to unsubscribe
+        if request.user.unsubscribe(pagename):
+            msg = _('Your subscription to this page has been removed.', formatted=False)
+        else:
+            msg = _("Can't remove regular expression subscription!", formatted=False) + u' ' + \
+                  _("Edit the subscription regular expressions in your "
+                    "UserPreferences.", formatted=True)
+    else:
+        # The user is not subscribed
+        msg = _('You need to be subscribed to unsubscribe.', formatted=False)
+
+    Page(request, pagename).send_page(msg=msg)
+