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'}),
24 url(r'^toolbar/scriptlets$', scriptlets, {'emitter_format': 'json'}),
27 url(r'^documents$', library_resource,
28 {'emitter_format': 'json'}, name="document_list_view"),
30 url(urlpath(r'documents'), library_resource,
31 name="document_list_view_withformat"),
33 url(urlpath(r'documents', DOC),
34 document_resource, name="document_view_withformat"),
36 url(urlpath(r'documents', DOC, format=False),
37 document_resource, {'emitter_format': 'json'},
38 name="document_view"),
40 url(urlpath(r'documents', DOC, 'text', REVISION, format=False),
41 document_text_resource, {'emitter_format': 'rawxml'},
44 url(urlpath(r'documents', DOC, 'html', REVISION, format=False),
45 document_text_resource, {'emitter_format': 'rawhtml'},
48 url(urlpath(r'documents', DOC, 'dc', REVISION),
50 name="docdc_view_withformat"),
52 url(urlpath(r'documents', DOC, 'dc', REVISION, format=False),
53 document_dc_resource, {'emitter_format': 'json'},
56 url(urlpath(r'documents', DOC, 'revision'),
57 document_merge, {'emitter_format': 'json'}, name="docmerge_view")
59 # url(r'^documents/(?P<docid>[^/]+)/parts$',
60 # document_resource, {'emitter_format': 'json'},
61 # name="docparts_view"),
63 # url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
64 # url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),