Revision 311c08cd
Suppression des url() dans les méthodes login, post_login & post_logout de toutes les applications !TurboGears
pour contourner un bug : http://trac.turbogears.org/ticket/2471 & http://vigilo-dev.si.c-s.fr/trac/ticket/40
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2221 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/controllers/root.py | ||
---|---|---|
2 | 2 |
# vim:set expandtab tabstop=4 shiftwidth=4: |
3 | 3 |
"""Vigigraph Controller""" |
4 | 4 |
|
5 |
from tg import expose, flash, require, url, request, redirect
|
|
5 |
from tg import expose, flash, require, request, redirect |
|
6 | 6 |
from pylons.i18n import ugettext as _, lazy_ugettext as l_ |
7 | 7 |
from repoze.what.predicates import Any, not_anonymous |
8 | 8 |
|
... | ... | |
37 | 37 |
return dict(page='index') |
38 | 38 |
|
39 | 39 |
@expose('login.html') |
40 |
def login(self, came_from=url('/')):
|
|
40 |
def login(self, came_from='/'):
|
|
41 | 41 |
"""Start the user login.""" |
42 | 42 |
login_counter = request.environ['repoze.who.logins'] |
43 | 43 |
if login_counter > 0: |
... | ... | |
46 | 46 |
came_from=came_from) |
47 | 47 |
|
48 | 48 |
@expose() |
49 |
def post_login(self, came_from=url('/')):
|
|
49 |
def post_login(self, came_from='/'):
|
|
50 | 50 |
""" |
51 | 51 |
Redirect the user to the initially requested page on successful |
52 | 52 |
authentication or redirect her back to the login page if login failed. |
... | ... | |
54 | 54 |
""" |
55 | 55 |
if not request.identity: |
56 | 56 |
login_counter = request.environ['repoze.who.logins'] + 1 |
57 |
redirect(url('/login', came_from=came_from, __logins=login_counter))
|
|
57 |
redirect('/login', came_from=came_from, __logins=login_counter)
|
|
58 | 58 |
userid = request.identity['repoze.who.userid'] |
59 | 59 |
flash(_('Welcome back, %s!') % userid) |
60 | 60 |
redirect(came_from) |
61 | 61 |
|
62 | 62 |
@expose() |
63 |
def post_logout(self, came_from=url('/')):
|
|
63 |
def post_logout(self, came_from='/'):
|
|
64 | 64 |
""" |
65 | 65 |
Redirect the user to the initially requested page on logout and say |
66 | 66 |
goodbye as well. |
Also available in: Unified diff