##// END OF EJS Templates
auth: use pyramid only redirections.
marcink -
r1790:c40bbd36 default
parent child Browse files
Show More
@@ -35,8 +35,8 b' from functools import wraps'
35
35
36 import ipaddress
36 import ipaddress
37 from pyramid.httpexceptions import HTTPForbidden, HTTPFound
37 from pyramid.httpexceptions import HTTPForbidden, HTTPFound
38 from pylons import url, request
38 from pylons import request
39 from pylons.controllers.util import abort, redirect
39 from pylons.controllers.util import abort
40 from pylons.i18n.translation import _
40 from pylons.i18n.translation import _
41 from sqlalchemy.orm.exc import ObjectDeletedError
41 from sqlalchemy.orm.exc import ObjectDeletedError
42 from sqlalchemy.orm import joinedload
42 from sqlalchemy.orm import joinedload
@@ -1265,7 +1265,7 b' class LoginRequired(object):'
1265 # we preserve the get PARAM
1265 # we preserve the get PARAM
1266 came_from = request.path_qs
1266 came_from = request.path_qs
1267 log.debug('redirecting to login page with %s' % (came_from,))
1267 log.debug('redirecting to login page with %s' % (came_from,))
1268 return redirect(
1268 raise HTTPFound(
1269 h.route_path('login', _query={'came_from': came_from}))
1269 h.route_path('login', _query={'came_from': came_from}))
1270
1270
1271
1271
@@ -1292,7 +1292,7 b' class NotAnonymous(object):'
1292 h.flash(_('You need to be a registered user to '
1292 h.flash(_('You need to be a registered user to '
1293 'perform this action'),
1293 'perform this action'),
1294 category='warning')
1294 category='warning')
1295 return redirect(
1295 raise HTTPFound(
1296 h.route_path('login', _query={'came_from': came_from}))
1296 h.route_path('login', _query={'came_from': came_from}))
1297 else:
1297 else:
1298 return func(*fargs, **fkwargs)
1298 return func(*fargs, **fkwargs)
@@ -1341,8 +1341,9 b' class HasAcceptedRepoType(object):'
1341 h.flash(h.literal(
1341 h.flash(h.literal(
1342 _('Action not supported for %s.' % rhodecode_repo.alias)),
1342 _('Action not supported for %s.' % rhodecode_repo.alias)),
1343 category='warning')
1343 category='warning')
1344 return redirect(
1344 raise HTTPFound(
1345 h.route_path('repo_summary', repo_name=cls.rhodecode_db_repo.repo_name))
1345 h.route_path('repo_summary',
1346 repo_name=cls.rhodecode_db_repo.repo_name))
1346
1347
1347
1348
1348 class PermsDecorator(object):
1349 class PermsDecorator(object):
General Comments 0
You need to be logged in to leave comments. Login now