Commit 9fa6cf74287bd2c6d553667394901e2b82205e77

Authored by Sergio Oliveira
1 parent 4f61f1ad

Using ProxyView CBV

src/colab/urls.py
@@ -32,10 +32,5 @@ urlpatterns = patterns('', @@ -32,10 +32,5 @@ urlpatterns = patterns('',
32 # Uncomment the next line to enable the admin: 32 # Uncomment the next line to enable the admin:
33 url(r'^colab/admin/', include(admin.site.urls)), 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 )
src/proxy/__init__.py 0 → 100644
src/proxy/admin.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.contrib import admin
  2 +
  3 +# Register your models here.
src/proxy/models.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.db import models
  2 +
  3 +# Create your models here.
src/proxy/tests.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.test import TestCase
  2 +
  3 +# Create your tests here.
src/proxy/urls.py 0 → 100644
@@ -0,0 +1,14 @@ @@ -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 +)
src/proxy/views.py 0 → 100644
@@ -0,0 +1,19 @@ @@ -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'