aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/git_browse/urls.py
blob: 141f533364a6dac478c28f2fa7c5b369798bcf11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from django.conf.urls.defaults import *
from django.conf import settings

from models import *

try:
    GITBROWSE_BASE = settings.GITBROWSE_BASE.strip('/')
except AttributeError:
    GITBROWSE_BASE='/home'

try:
    ADMIN_URL = settings.ADMIN_URL
except AttributeError:
    ADMIN_URL='/admin'
if ADMIN_URL[-1] == '/':
    ADMIN_URL=ADMIN_URL[:-1]

info_dict = { 'extra_context': { 'admin_url': ADMIN_URL,
                                 } }

urlpatterns = patterns('django.views.generic.list_detail',
	(r'^$', 'object_list',
		dict(info_dict, queryset=Repository.objects.all(),
		     allow_empty= True)),
#	(r'^(?P<object_id>\d+)/$', 'object_detail',
#		dict(info_dict, queryset=Gallery.objects.all())),
#	(r'^detail/(?P<object_id>\d+)/$', 'object_detail',
#		dict(info_dict, queryset=Photo.objects.all())),
)

urlpatterns += patterns('bn_django.git_browse.views',
    (r'^(?P<repo>[\w\-\_]*)/$', 'repo_info',), 
    (r'^(?P<repo>[\w\-\_]*)/branches/$', 'view_branches',), 
    (r'^(?P<repo>[\w\-\_]*)/log/$', 'view_log',), 
    (r'^(?P<repo>[\w\-\_]*)/obj/(?P<hash>[0-9a-z]{40})/$', 'view_obj',), 
    (r'^(?P<repo>[\w\-\_]*)/commit/(?P<hash>[0-9a-z]{40})/$', 'view_commit',), 
    (r'^(?P<repo>[\w\-\_]*)/commit/$', 'view_commit',), 
    (r'^(?P<repo>[\w\-\_]*)/commit/(?P<hash>[0-9a-z]{40})/zip/$', 'zip',), 
    #TODO: head and tag views
    (r'^(?P<repo>[\w\-\_]*)/tag/(?P<hash>[\w\-\_]+)/$', 'view_commit',), 
    (r'^(?P<repo>[\w\-\_]*)/tag/(?P<hash>[0-9a-z]{40})/zip/$', 'zip',), 
    (r'^(?P<repo>[\w\-\_]*)/head/(?P<hash>[\w\-\_]+)/$', 'view_commit',), 
    (r'^(?P<repo>[\w\-\_]*)/head/(?P<hash>[0-9a-z]{40})/zip/$', 'zip',), 
    (r'^(?P<repo>[\w\-\_]*)/blob/(?P<hash>[0-9a-z]{40})/$', 'view_blob',), 
    (r'^(?P<repo>[\w\-\_]*)/tree/$', 'view_tree',), 
    (r'^(?P<repo>[\w\-\_]*)/tree/(?P<hash>[0-9a-z]{40})/$', 'view_tree',), 
    (r'^(?P<repo>[\w\-\_]*)/tree/(?P<hash>[0-9a-z]{40})/zip/$', 'zip',), 
)