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|django)$"
14 library_resource = Resource(LibraryHandler, **authdata)
15 document_resource = Resource(DocumentHandler, **authdata)
16 document_text_resource = Resource(DocumentTextHandler, **authdata)
18 urlpatterns = patterns('',
19 # url(r'^hello$', hello_resource, {'emitter_format': 'json'}),
20 # url(r'^hello\.(?P<emitter_format>.+)$', hello_resource),
23 url(r'^documents$', library_resource, {'emitter_format': 'json'},
24 name="document_list_view"),
26 url(r'^documents/(?P<docid>[^/]+)'+FORMAT_EXT,
27 document_resource, name="document_view_withformat"),
29 url(r'^documents/(?P<docid>[^/]+)$',
30 document_resource, {'emitter_format': 'json'},
31 name="document_view"),
33 url(r'^documents/(?P<docid>[^/]+)/text$',
34 document_text_resource, {'emitter_format': 'rawxml'},
37 url(r'^documents/(?P<docid>[^/]+)/dc$',
38 document_resource, {'emitter_format': 'json'},
41 url(r'^documents/(?P<docid>[^/]+)/parts$',
42 document_resource, {'emitter_format': 'json'},
43 name="docparts_view"),
45 # url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
46 # url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),