diff --git a/colab/proxy/gitlab/views.py b/colab/proxy/gitlab/views.py index c09c19c..14f0d6c 100644 --- a/colab/proxy/gitlab/views.py +++ b/colab/proxy/gitlab/views.py @@ -5,5 +5,5 @@ from ..utils.views import ColabProxyView class GitlabProxyView(ColabProxyView): - upstream = settings.PROXIED_APPS['gitlab']['upstream'] + app_label = 'gitlab' diazo_theme_template = 'proxy/gitlab.html' diff --git a/colab/proxy/jenkins/views.py b/colab/proxy/jenkins/views.py index 079fc8b..e7ab64e 100644 --- a/colab/proxy/jenkins/views.py +++ b/colab/proxy/jenkins/views.py @@ -5,4 +5,4 @@ from ..utils.views import ColabProxyView class JenkinsProxyView(ColabProxyView): - upstream = settings.PROXIED_APPS['jenkins']['upstream'] + app_label = 'jenkins' diff --git a/colab/proxy/redmine/views.py b/colab/proxy/redmine/views.py index 5899440..34f6f06 100644 --- a/colab/proxy/redmine/views.py +++ b/colab/proxy/redmine/views.py @@ -5,5 +5,5 @@ from ..utils.views import ColabProxyView class RedmineProxyView(ColabProxyView): - upstream = settings.PROXIED_APPS['redmine']['upstream'] + app_label = 'redmine' diazo_theme_template = 'proxy/redmine.html' diff --git a/colab/proxy/trac/views.py b/colab/proxy/trac/views.py index 5ccdc85..d7291e4 100644 --- a/colab/proxy/trac/views.py +++ b/colab/proxy/trac/views.py @@ -8,7 +8,7 @@ from .models import Wiki, Ticket, Revision class TracProxyView(HitCounterViewMixin, ColabProxyView): - upstream = settings.PROXIED_APPS['trac']['upstream'] + app_label = 'trac' diazo_theme_template = 'proxy/trac.html' def get_object(self): diff --git a/colab/proxy/utils/views.py b/colab/proxy/utils/views.py index 429ebe6..8393046 100644 --- a/colab/proxy/utils/views.py +++ b/colab/proxy/utils/views.py @@ -8,3 +8,12 @@ class ColabProxyView(ProxyView): add_remote_user = settings.REVPROXY_ADD_REMOTE_USER diazo_theme_template = 'base.html' html5 = True + + @property + def upstream(self): + proxy_config = settings.PROXIED_APPS.get(self.app_label, {}) + return proxy_config.get('upstream') + + @property + def app_label(self): + raise NotImplementedError('app_label attribute must be set') -- libgit2 0.21.2