X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8d62c0c82718b59c077b611fca1cd9f8054a8c41..b2d72160e2a68991c66ea6017b871d7f42c0b29d:/apps/api/urls.py diff --git a/apps/api/urls.py b/apps/api/urls.py new file mode 100644 index 00000000..ada879c4 --- /dev/null +++ b/apps/api/urls.py @@ -0,0 +1,48 @@ +__author__="lreqc" +__date__ ="$2009-09-17 16:16:54$" + +from django.conf.urls.defaults import * +from piston.resource import Resource + +from api.handlers import * +from api.utils import TextEmitter, DjangoAuth + +authdata = {'authentication': DjangoAuth()} + +FORMAT_EXT = r"\.(?Pxml|json|yaml|django)$" + +library_resource = Resource(LibraryHandler, **authdata) +document_resource = Resource(DocumentHandler, **authdata) +document_text_resource = Resource(DocumentTextHandler, **authdata) + +urlpatterns = patterns('', +# url(r'^hello$', hello_resource, {'emitter_format': 'json'}), +# url(r'^hello\.(?P.+)$', hello_resource), + + # Documents + url(r'^documents$', library_resource, {'emitter_format': 'json'}, + name="document_list_view"), + + url(r'^documents/(?P[^/]+)'+FORMAT_EXT, + document_resource, name="document_view_withformat"), + + url(r'^documents/(?P[^/]+)$', + document_resource, {'emitter_format': 'json'}, + name="document_view"), + + url(r'^documents/(?P[^/]+)/text$', + document_text_resource, {'emitter_format': 'rawxml'}, + name="doctext_view"), + + url(r'^documents/(?P[^/]+)/dc$', + document_resource, {'emitter_format': 'json'}, + name="docdc_view"), + + url(r'^documents/(?P[^/]+)/parts$', + document_resource, {'emitter_format': 'json'}, + name="docparts_view"), + + # url(r'^posts/(?P[^/]+)/$', blogpost_resource), + # url(r'^other/(?P[^/]+)/(?P.+)/$', arbitrary_resource), +) +