Commit 9fa6cf74287bd2c6d553667394901e2b82205e77
1 parent
4f61f1ad
Exists in
master
and in
39 other branches
Using ProxyView CBV
Showing
7 changed files
with
43 additions
and
6 deletions
Show diff stats
src/colab/urls.py
| ... | ... | @@ -32,10 +32,5 @@ urlpatterns = patterns('', |
| 32 | 32 | # Uncomment the next line to enable the admin: |
| 33 | 33 | url(r'^colab/admin/', include(admin.site.urls)), |
| 34 | 34 | |
| 35 | - # Trac URLs | |
| 36 | - url(u'^(?P<path>(?:admin|wiki|changeset|newticket|ticket|chrome|timeline|roadmap|browser|report|tags|query|about|prefs|log|attachment|raw-attachment).*)$', | |
| 37 | - 'revproxy.views.proxy', {'base_url': settings.COLAB_TRAC_URL}), | |
| 38 | - | |
| 39 | - # Jenkins URLs | |
| 40 | - url(u'^ci/(?P<path>.*)$', 'revproxy.views.proxy', {'base_url': settings.COLAB_CI_URL}), | |
| 35 | + url(r'^', include('proxy.urls')), | |
| 41 | 36 | ) | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | + | |
| 2 | +from django.conf.urls import patterns, include, url | |
| 3 | + | |
| 4 | +from .views import TracProxyView, JenkinsProxyView | |
| 5 | + | |
| 6 | + | |
| 7 | +urlpatterns = patterns('', | |
| 8 | + # Trac URLs | |
| 9 | + url(r'^(?P<path>(?:admin|wiki|changeset|newticket|ticket|chrome|timeline|roadmap|browser|report|tags|query|about|prefs|log|attachment|raw-attachment).*)$', | |
| 10 | + TracProxyView.as_view()), | |
| 11 | + | |
| 12 | + # Jenkins URLs | |
| 13 | + url(r'^ci/(?P<path>.*)$', JenkinsProxyView.as_view()), | |
| 14 | +) | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | + | |
| 2 | +import os | |
| 3 | + | |
| 4 | +from django.conf import settings | |
| 5 | + | |
| 6 | +from revproxy.views import ProxyView | |
| 7 | + | |
| 8 | + | |
| 9 | +class TracProxyView(ProxyView): | |
| 10 | + base_url = settings.COLAB_TRAC_URL | |
| 11 | + add_remote_user = settings.REVPROXY_ADD_REMOTE_USER | |
| 12 | + diazo_template_theme = 'base.html' | |
| 13 | + diazo_rules = os.path.join(settings.BASE_DIR, 'proxy', 'trac_rules.xml') | |
| 14 | + | |
| 15 | + | |
| 16 | +class JenkinsProxyView(ProxyView): | |
| 17 | + base_url = settings.COLAB_CI_URL | |
| 18 | + add_remote_user = settings.REVPROXY_ADD_REMOTE_USER | |
| 19 | + diazo_template_theme = 'base.html' | ... | ... |