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