Commit 8b9261cb86e8021ace62b14e45ca87e4e651f6f6
1 parent
0488c377
Exists in
master
and in
39 other branches
Setting app_label in views to allow get configuration
Showing
5 changed files
with
13 additions
and
4 deletions
Show diff stats
colab/proxy/gitlab/views.py
colab/proxy/jenkins/views.py
colab/proxy/redmine/views.py
colab/proxy/trac/views.py
... | ... | @@ -8,7 +8,7 @@ from .models import Wiki, Ticket, Revision |
8 | 8 | |
9 | 9 | |
10 | 10 | class TracProxyView(HitCounterViewMixin, ColabProxyView): |
11 | - upstream = settings.PROXIED_APPS['trac']['upstream'] | |
11 | + app_label = 'trac' | |
12 | 12 | diazo_theme_template = 'proxy/trac.html' |
13 | 13 | |
14 | 14 | def get_object(self): | ... | ... |
colab/proxy/utils/views.py
... | ... | @@ -8,3 +8,12 @@ class ColabProxyView(ProxyView): |
8 | 8 | add_remote_user = settings.REVPROXY_ADD_REMOTE_USER |
9 | 9 | diazo_theme_template = 'base.html' |
10 | 10 | html5 = True |
11 | + | |
12 | + @property | |
13 | + def upstream(self): | |
14 | + proxy_config = settings.PROXIED_APPS.get(self.app_label, {}) | |
15 | + return proxy_config.get('upstream') | |
16 | + | |
17 | + @property | |
18 | + def app_label(self): | |
19 | + raise NotImplementedError('app_label attribute must be set') | ... | ... |