Show More
@@ -36,9 +36,6 b' from functools import wraps' | |||
|
36 | 36 | import ipaddress |
|
37 | 37 | from beaker.cache import cache_region |
|
38 | 38 | from pyramid.httpexceptions import HTTPForbidden, HTTPFound, HTTPNotFound |
|
39 | from pylons.i18n.translation import _ | |
|
40 | # NOTE(marcink): this has to be removed only after pyramid migration, | |
|
41 | # replace with _ = request.translate | |
|
42 | 39 | from sqlalchemy.orm.exc import ObjectDeletedError |
|
43 | 40 | from sqlalchemy.orm import joinedload |
|
44 | 41 | from zope.cachedescriptors.property import Lazy as LazyProperty |
@@ -1325,7 +1322,7 b' def get_csrf_token(session, force_new=Fa' | |||
|
1325 | 1322 | Return the current authentication token, creating one if one doesn't |
|
1326 | 1323 | already exist and the save_if_missing flag is present. |
|
1327 | 1324 | |
|
1328 |
:param session: pass in the py |
|
|
1325 | :param session: pass in the pyramid session, else we use the global ones | |
|
1329 | 1326 | :param force_new: force to re-generate the token and store it in session |
|
1330 | 1327 | :param save_if_missing: save the newly generated token if it's missing in |
|
1331 | 1328 | session |
@@ -1344,11 +1341,6 b' def get_csrf_token(session, force_new=Fa' | |||
|
1344 | 1341 | def get_request(perm_class_instance): |
|
1345 | 1342 | from pyramid.threadlocal import get_current_request |
|
1346 | 1343 | pyramid_request = get_current_request() |
|
1347 | if not pyramid_request: | |
|
1348 | # return global request of pylons in case pyramid isn't available | |
|
1349 | # NOTE(marcink): this should be removed after migration to pyramid | |
|
1350 | from pylons import request | |
|
1351 | return request | |
|
1352 | 1344 | return pyramid_request |
|
1353 | 1345 | |
|
1354 | 1346 | |
@@ -1436,6 +1428,7 b' class LoginRequired(object):' | |||
|
1436 | 1428 | cls = fargs[0] |
|
1437 | 1429 | user = cls._rhodecode_user |
|
1438 | 1430 | request = self._get_request() |
|
1431 | _ = request.translate | |
|
1439 | 1432 | |
|
1440 | 1433 | loc = "%s:%s" % (cls.__class__.__name__, func.__name__) |
|
1441 | 1434 | log.debug('Starting login restriction checks for user: %s' % (user,)) |
@@ -1525,7 +1518,7 b' class NotAnonymous(object):' | |||
|
1525 | 1518 | cls = fargs[0] |
|
1526 | 1519 | self.user = cls._rhodecode_user |
|
1527 | 1520 | request = self._get_request() |
|
1528 | ||
|
1521 | _ = request.translate | |
|
1529 | 1522 | log.debug('Checking if user is not anonymous @%s' % cls) |
|
1530 | 1523 | |
|
1531 | 1524 | anonymous = self.user.username == User.DEFAULT_USER |
@@ -1560,6 +1553,8 b' class PermsDecorator(object):' | |||
|
1560 | 1553 | import rhodecode.lib.helpers as h |
|
1561 | 1554 | cls = fargs[0] |
|
1562 | 1555 | _user = cls._rhodecode_user |
|
1556 | request = self._get_request() | |
|
1557 | _ = request.translate | |
|
1563 | 1558 | |
|
1564 | 1559 | log.debug('checking %s permissions %s for %s %s', |
|
1565 | 1560 | self.__class__.__name__, self.required_perms, cls, _user) |
General Comments 0
You need to be logged in to leave comments.
Login now