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\d+)/$', 'object_detail', # dict(info_dict, queryset=Gallery.objects.all())), # (r'^detail/(?P\d+)/$', 'object_detail', # dict(info_dict, queryset=Photo.objects.all())), ) urlpatterns += patterns('bn_django.git_browse.views', (r'^(?P[\w\-\_]*)/$', 'repo_info',), (r'^(?P[\w\-\_]*)/branches/$', 'view_branches',), (r'^(?P[\w\-\_]*)/log/$', 'view_log',), (r'^(?P[\w\-\_]*)/obj/(?P[0-9a-z]{40})/$', 'view_obj',), (r'^(?P[\w\-\_]*)/commit/(?P[0-9a-z]{40})/$', 'view_commit',), (r'^(?P[\w\-\_]*)/commit/$', 'view_commit',), (r'^(?P[\w\-\_]*)/commit/(?P[0-9a-z]{40})/zip/$', 'zip',), #TODO: head and tag views (r'^(?P[\w\-\_]*)/tag/(?P[\w\-\_]+)/$', 'view_commit',), (r'^(?P[\w\-\_]*)/tag/(?P[0-9a-z]{40})/zip/$', 'zip',), (r'^(?P[\w\-\_]*)/head/(?P[\w\-\_]+)/$', 'view_commit',), (r'^(?P[\w\-\_]*)/head/(?P[0-9a-z]{40})/zip/$', 'zip',), (r'^(?P[\w\-\_]*)/blob/(?P[0-9a-z]{40})/$', 'view_blob',), (r'^(?P[\w\-\_]*)/tree/$', 'view_tree',), (r'^(?P[\w\-\_]*)/tree/(?P[0-9a-z]{40})/$', 'view_tree',), (r'^(?P[\w\-\_]*)/tree/(?P[0-9a-z]{40})/zip/$', 'zip',), )