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, 'gallery', format=False),
46 document_gallery, {'emitter_format': 'json'},
47 name="docgallery_view"),
50 url(urlpath(r'documents', DOC, 'text', format=False),
51 document_text_resource, {'emitter_format': 'rawxml'},
55 url(urlpath(r'documents', DOC, 'html', format=False),
56 document_html_resource, {'emitter_format': 'rawhtml'},
60 #url(urlpath(r'documents', DOC, 'dc'),
61 # document_dc_resource,
62 # name="docdc_view_withformat"),
64 url(urlpath(r'documents', DOC, 'dc', format=False),
65 document_dc_resource, {'emitter_format': 'json'},
69 url(urlpath(r'documents', DOC, 'revision', format=False),
70 document_merge, {'emitter_format': 'json'}, name="docmerge_view")
72 # url(r'^documents/(?P<docid>[^/]+)/parts$',
73 # document_resource, {'emitter_format': 'json'},
74 # name="docparts_view"),
76 # url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
77 # url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),