Show More
@@ -251,6 +251,13 b' class RepoAppView(BaseAppView):' | |||||
251 | return default |
|
251 | return default | |
252 |
|
252 | |||
253 |
|
253 | |||
|
254 | class RepoGroupAppView(BaseAppView): | |||
|
255 | def __init__(self, context, request): | |||
|
256 | super(RepoGroupAppView, self).__init__(context, request) | |||
|
257 | self.db_repo_group = request.db_repo_group | |||
|
258 | self.db_repo_group_name = self.db_repo_group.group_name | |||
|
259 | ||||
|
260 | ||||
254 | class DataGridAppView(object): |
|
261 | class DataGridAppView(object): | |
255 | """ |
|
262 | """ | |
256 | Common class to have re-usable grid rendering components |
|
263 | Common class to have re-usable grid rendering components |
@@ -273,7 +273,7 b' def includeme(config):' | |||||
273 | if asbool(settings.get('appenlight', 'false')): |
|
273 | if asbool(settings.get('appenlight', 'false')): | |
274 | config.include('appenlight_client.ext.pyramid_tween') |
|
274 | config.include('appenlight_client.ext.pyramid_tween') | |
275 |
|
275 | |||
276 |
if |
|
276 | if 'mako.default_filters' not in settings: | |
277 | # set custom default filters if we don't have it defined |
|
277 | # set custom default filters if we don't have it defined | |
278 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' |
|
278 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' | |
279 | settings['mako.default_filters'] = 'h_filter' |
|
279 | settings['mako.default_filters'] = 'h_filter' |
@@ -54,7 +54,7 b' def integrations_event_handler(event):' | |||||
54 | integration_model.send_event(integration, event) |
|
54 | integration_model.send_event(integration, event) | |
55 | except Exception: |
|
55 | except Exception: | |
56 | log.exception( |
|
56 | log.exception( | |
57 | 'failure occured when sending event %s to integration %s' % ( |
|
57 | 'failure occurred when sending event %s to integration %s' % ( | |
58 | event, integration)) |
|
58 | event, integration)) | |
59 |
|
59 | |||
60 |
|
60 |
@@ -1463,7 +1463,8 b' class HasRepoPermissionAnyDecorator(Perm' | |||||
1463 | try: |
|
1463 | try: | |
1464 | user_perms = set([perms['repositories'][repo_name]]) |
|
1464 | user_perms = set([perms['repositories'][repo_name]]) | |
1465 | except KeyError: |
|
1465 | except KeyError: | |
1466 | log.debug('cannot locate repo with name: `%s` in permissions defs', |
|
1466 | log.debug( | |
|
1467 | 'cannot locate repo with name: `%s` in permissions defs', | |||
1467 |
|
|
1468 | repo_name) | |
1468 | return False |
|
1469 | return False | |
1469 |
|
1470 | |||
@@ -1490,7 +1491,8 b' class HasRepoGroupPermissionAllDecorator' | |||||
1490 | try: |
|
1491 | try: | |
1491 | user_perms = set([perms['repositories_groups'][group_name]]) |
|
1492 | user_perms = set([perms['repositories_groups'][group_name]]) | |
1492 | except KeyError: |
|
1493 | except KeyError: | |
1493 | log.debug('cannot locate repo group with name: `%s` in permissions defs', |
|
1494 | log.debug( | |
|
1495 | 'cannot locate repo group with name: `%s` in permissions defs', | |||
1494 |
|
|
1496 | group_name) | |
1495 | return False |
|
1497 | return False | |
1496 |
|
1498 | |||
@@ -1518,7 +1520,8 b' class HasRepoGroupPermissionAnyDecorator' | |||||
1518 | try: |
|
1520 | try: | |
1519 | user_perms = set([perms['repositories_groups'][group_name]]) |
|
1521 | user_perms = set([perms['repositories_groups'][group_name]]) | |
1520 | except KeyError: |
|
1522 | except KeyError: | |
1521 | log.debug('cannot locate repo group with name: `%s` in permissions defs', |
|
1523 | log.debug( | |
|
1524 | 'cannot locate repo group with name: `%s` in permissions defs', | |||
1522 |
|
|
1525 | group_name) | |
1523 | return False |
|
1526 | return False | |
1524 |
|
1527 |
@@ -96,11 +96,18 b' def repo_name_slug(value):' | |||||
96 | # PERM DECORATOR HELPERS FOR EXTRACTING NAMES FOR PERM CHECKS |
|
96 | # PERM DECORATOR HELPERS FOR EXTRACTING NAMES FOR PERM CHECKS | |
97 | #============================================================================== |
|
97 | #============================================================================== | |
98 | def get_repo_slug(request): |
|
98 | def get_repo_slug(request): | |
99 | if isinstance(request, Request) and getattr(request, 'db_repo', None): |
|
99 | _repo = '' | |
100 | # pyramid |
|
100 | if isinstance(request, Request): | |
|
101 | if hasattr(request, 'db_repo'): | |||
|
102 | # if our requests has set db reference use it for name, this | |||
|
103 | # translates the example.com/_<id> into proper repo names | |||
101 | _repo = request.db_repo.repo_name |
|
104 | _repo = request.db_repo.repo_name | |
102 | else: |
|
105 | elif getattr(request, 'matchdict', None): | |
|
106 | # pyramid | |||
|
107 | _repo = request.matchdict.get('repo_name') | |||
|
108 | ||||
103 |
|
|
109 | # TODO(marcink): remove after pylons migration... | |
|
110 | if not _repo: | |||
104 | _repo = request.environ['pylons.routes_dict'].get('repo_name') |
|
111 | _repo = request.environ['pylons.routes_dict'].get('repo_name') | |
105 |
|
112 | |||
106 | if _repo: |
|
113 | if _repo: | |
@@ -109,10 +116,18 b' def get_repo_slug(request):' | |||||
109 |
|
116 | |||
110 |
|
117 | |||
111 | def get_repo_group_slug(request): |
|
118 | def get_repo_group_slug(request): | |
112 | if isinstance(request, Request) and getattr(request, 'matchdict', None): |
|
119 | _group = '' | |
|
120 | if isinstance(request, Request): | |||
|
121 | if hasattr(request, 'db_repo_group'): | |||
|
122 | # if our requests has set db reference use it for name, this | |||
|
123 | # translates the example.com/_<id> into proper repo group names | |||
|
124 | _group = request.db_repo_group.group_name | |||
|
125 | elif getattr(request, 'matchdict', None): | |||
113 | # pyramid |
|
126 | # pyramid | |
114 | _group = request.matchdict.get('repo_group_name') |
|
127 | _group = request.matchdict.get('repo_group_name') | |
115 | else: |
|
128 | ||
|
129 | # TODO(marcink): remove after pylons migration... | |||
|
130 | if not _group: | |||
116 | _group = request.environ['pylons.routes_dict'].get('group_name') |
|
131 | _group = request.environ['pylons.routes_dict'].get('group_name') | |
117 |
|
132 | |||
118 | if _group: |
|
133 | if _group: |
General Comments 0
You need to be logged in to leave comments.
Login now