2 __date__ ="$2009-09-17 16:16:54$"
4 from django.conf.urls.defaults import *
5 from piston.resource import Resource
7 from api.handlers import *
8 from api.utils import TextEmitter, DjangoAuth
10 authdata = {'authentication': DjangoAuth()}
12 FORMAT_EXT = r"\.(?P<emitter_format>xml|json|yaml)$"
14 library_resource = Resource(LibraryHandler, **authdata)
15 document_resource = Resource(DocumentHandler, **authdata)
16 document_text_resource = Resource(DocumentTextHandler, **authdata)
17 document_dc_resource = Resource(DocumentDublinCoreHandler, **authdata)
19 urlpatterns = patterns('',
20 # url(r'^hello$', hello_resource, {'emitter_format': 'json'}),
21 # url(r'^hello\.(?P<emitter_format>.+)$', hello_resource),
24 url(r'^documents$', library_resource,
25 {'emitter_format': 'json'}, name="document_list_view"),
27 url(r'^documents'+FORMAT_EXT, library_resource,
28 name="document_list_view_withformat"),
30 url(r'^documents/(?P<docid>[^/]+)'+FORMAT_EXT,
31 document_resource, name="document_view_withformat"),
33 url(r'^documents/(?P<docid>[^/]+)$',
34 document_resource, {'emitter_format': 'json'},
35 name="document_view"),
37 url(r'^documents/(?P<docid>[^/]+)/text$',
38 document_text_resource, {'emitter_format': 'rawxml'},
41 url(r'^documents/(?P<docid>[^/]+)/dc' + FORMAT_EXT,
43 name="docdc_view_withformat"),
45 url(r'^documents/(?P<docid>[^/]+)/dc$',
46 document_dc_resource, {'emitter_format': 'json'},
49 url(r'^documents/(?P<docid>[^/]+)/parts$',
50 document_resource, {'emitter_format': 'json'},
51 name="docparts_view"),
53 # url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
54 # url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),