Merge branch 'master' of stigma:platforma
[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
6 from api.resources import *
7
8 FORMAT = r"\.(?P<emitter_format>xml|json|yaml)"
9 DOC = r'(?P<docid>[^/]+)'
10 # REVISION = r'(?P<revision>latest|[0-9a-f]{40})'
11
12 def urlpath(*args, **kwargs):
13     format = kwargs.get('format', True)
14     return r'^' + (r'/'.join(args)) + (FORMAT if format else '') + '$'
15
16 urlpatterns = patterns('',
17 #    url(r'^hello$', hello_resource, {'emitter_format': 'json'}),
18 #    url(r'^hello\.(?P<emitter_format>.+)$', hello_resource),
19
20     # Toolbar
21     url(r'^toolbar/buttons$', toolbar_buttons, {'emitter_format': 'json'}),    
22     url(r'^toolbar/scriptlets$', scriptlets, {'emitter_format': 'json'}),
23
24     # Pull requests
25     url(r"^pull-requests$", pullrequest_collection,
26         {'emitter_format': 'json'} ),
27         
28     url(r"^pull-requests/(?P<prq_id>\d+)$", pullrequest_rsrc,
29         {'emitter_format': 'json'}, name="pullrequest_view" ),    
30     
31     # Documents
32     url(r'^documents$', library_resource,
33         {'emitter_format': 'json'}, name="document_list_view"),
34
35     url(urlpath(r'documents'), library_resource,
36         name="document_list_view_withformat"),
37         
38     #url(urlpath(r'documents', DOC),
39     #    document_resource, name="document_view_withformat"),
40
41     url(urlpath(r'documents', DOC, format=False),
42         document_resource, {'emitter_format': 'json'},
43         name="document_view"),
44
45     url(urlpath(r'documents', DOC, 'gallery', format=False),
46         document_gallery, {'emitter_format': 'json'},
47         name="docgallery_view"),
48
49     # XML    
50     url(urlpath(r'documents', DOC, 'text', format=False),
51         document_text_resource, {'emitter_format': 'rawxml'},
52         name="doctext_view"),
53
54     # HTML
55     url(urlpath(r'documents', DOC, 'html', format=False),
56         document_html_resource, {'emitter_format': 'rawhtml'},
57         name="dochtml_view"),
58
59     # DC
60     #url(urlpath(r'documents', DOC, 'dc'),
61     #    document_dc_resource,
62     #    name="docdc_view_withformat"),
63
64     url(urlpath(r'documents', DOC, 'dc', format=False),
65         document_dc_resource, {'emitter_format': 'json'},
66         name="docdc_view"),
67
68     # MERGE
69     url(urlpath(r'documents', DOC, 'revision', format=False),
70         document_merge, {'emitter_format': 'json'}, name="docmerge_view")
71
72 #    url(r'^documents/(?P<docid>[^/]+)/parts$',
73 #        document_resource, {'emitter_format': 'json'},
74 #        name="docparts_view"),
75         
76   #  url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
77   #  url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),
78 )
79