2 __date__ ="$2009-09-17 16:16:54$"
4 from django.conf.urls.defaults import *
6 from api.resources import *
8 FORMAT = r"\.(?P<emitter_format>xml|json|yaml)"
9 DOC = r'(?P<docid>[^/]+)'
10 REVISION = r'(?P<revision>latest|[0-9a-f]{40})'
12 def urlpath(*args, **kwargs):
13 format = kwargs.get('format', True)
14 return r'^' + (r'/'.join(args)) + (FORMAT if format else '') + '$'
16 urlpatterns = patterns('',
17 # url(r'^hello$', hello_resource, {'emitter_format': 'json'}),
18 # url(r'^hello\.(?P<emitter_format>.+)$', hello_resource),
21 url(r'^toolbar/buttons$', toolbar_buttons, {'emitter_format': 'json'}),
22 url(r'^toolbar/scriptlets$', scriptlets, {'emitter_format': 'json'}),
25 url(r"^pull-requests$", pullrequest_collection,
26 {'emitter_format': 'json'} ),
28 url(r"^pull-requests/(?P<prq_id>\d+)$", pullrequest_rsrc,
29 {'emitter_format': 'json'}, name="pullrequest_view" ),
32 url(r'^documents$', library_resource,
33 {'emitter_format': 'json'}, name="document_list_view"),
35 url(urlpath(r'documents'), library_resource,
36 name="document_list_view_withformat"),
38 url(urlpath(r'documents', DOC),
39 document_resource, name="document_view_withformat"),
41 url(urlpath(r'documents', DOC, format=False),
42 document_resource, {'emitter_format': 'json'},
43 name="document_view"),
45 url(urlpath(r'documents', DOC, 'text', REVISION, format=False),
46 document_text_resource, {'emitter_format': 'rawxml'},
49 url(urlpath(r'documents', DOC, 'html', REVISION, format=False),
50 document_html_resource, {'emitter_format': 'rawhtml'},
53 url(urlpath(r'documents', DOC, 'dc', REVISION),
55 name="docdc_view_withformat"),
57 url(urlpath(r'documents', DOC, 'dc', REVISION, format=False),
58 document_dc_resource, {'emitter_format': 'json'},
61 url(urlpath(r'documents', DOC, 'revision', format=False),
62 document_merge, {'emitter_format': 'json'}, name="docmerge_view")
64 # url(r'^documents/(?P<docid>[^/]+)/parts$',
65 # document_resource, {'emitter_format': 'json'},
66 # name="docparts_view"),
68 # url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
69 # url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),