Merge branch 'master' into view-refactor
[redakcja.git] / apps / api / urls.py
1 __author__="lreqc"
2 __date__ ="$2009-09-17 16:16:54$"
3
4 from django.conf.urls.defaults import *
5 from piston.resource import Resource
6
7 from api.handlers import *
8 from api.utils import TextEmitter, DjangoAuth
9
10 authdata = {'authentication': DjangoAuth()}
11
12 FORMAT_EXT = r"\.(?P<emitter_format>xml|json|yaml|django)$"
13
14 library_resource = Resource(LibraryHandler, **authdata)
15 document_resource = Resource(DocumentHandler, **authdata)
16 document_text_resource = Resource(DocumentTextHandler, **authdata)
17
18 urlpatterns = patterns('',
19 #    url(r'^hello$', hello_resource, {'emitter_format': 'json'}),
20 #    url(r'^hello\.(?P<emitter_format>.+)$', hello_resource),
21
22     # Documents
23     url(r'^documents$', library_resource, {'emitter_format': 'json'},
24         name="document_list_view"),
25
26     url(r'^documents/(?P<docid>[^/]+)'+FORMAT_EXT,
27         document_resource, name="document_view_withformat"),
28
29     url(r'^documents/(?P<docid>[^/]+)$',
30         document_resource, {'emitter_format': 'json'},
31         name="document_view"),
32     
33     url(r'^documents/(?P<docid>[^/]+)/text$',
34         document_text_resource, {'emitter_format': 'rawxml'},
35         name="doctext_view"),
36
37     url(r'^documents/(?P<docid>[^/]+)/dc$',
38         document_resource, {'emitter_format': 'json'},
39         name="docdc_view"),
40
41     url(r'^documents/(?P<docid>[^/]+)/parts$',
42         document_resource, {'emitter_format': 'json'},
43         name="docparts_view"),
44         
45   #  url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
46   #  url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),
47 )
48