annotate MoinMoin/action/logout.py @ 5298:d57b74bc4cbd

formatter: text_html comment moved to docstring
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 20 Nov 2009 09:49:05 +0100
parents ba14d391c2ba
children
rev   line source
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
2 """
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
3 MoinMoin - logout action
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
4
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
5 The real logout is done in MoinMoin.request.
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
6 Here is just some stuff to notify the user.
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
7
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
8 @copyright: 2005-2006 Radomirs Cirskis <nad2000@gmail.com>
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
9 @license: GNU GPL, see COPYING for details.
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
10 """
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
11
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
12 from MoinMoin.Page import Page
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
13
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 483
diff changeset
14 def execute(pagename, request):
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
15 return LogoutHandler(pagename, request).handle()
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
16
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
17 class LogoutHandler:
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
18 def __init__(self, pagename, request):
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
19 self.request = request
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
20 self._ = request.getText
949
cbbde07e00c4 whitespace-only cleanup, small style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 483
diff changeset
21 self.page = Page(request, pagename)
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
22
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
23 def handle(self):
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
24 _ = self._
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1918
diff changeset
25 # if the user really was logged out say so,
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1918
diff changeset
26 # but if the user manually added ?action=logout
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1918
diff changeset
27 # and that isn't really supported, then don't
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1918
diff changeset
28 if not self.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: 2009
diff changeset
29 self.request.theme.add_msg(_("You are now logged out."), "info")
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: 2009
diff changeset
30 return self.page.send_page()
483
a594780d5e64 Login macro, login/logout/UserPreferences actions
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
31