Poprawienie requirements.txt (w tym podwyższenie wymaganej wersji Django do 1.1.1...
[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     # HTML Renderer service
20     url(r'^render$', 'api.views.render'),
21     
22     # Toolbar
23     url(r'^toolbar/buttons$', toolbar_buttons, {'emitter_format': 'json'},
24         name="toolbar_buttons"
25     ),
26     
27     url(r'^toolbar/scriptlets$', scriptlets, {'emitter_format': 'json'},
28         name="toolbar_scriptlets"
29     ),
30
31     # Pull requests
32     url(r"^pull-requests$", pullrequest_collection,
33         {'emitter_format': 'json'}, name="pullrequest_list" ),
34         
35     url(r"^pull-requests/(?P<prq_id>\d+)$", pullrequest_rsrc,
36         {'emitter_format': 'json'}, name="pullrequest_view" ),
37         
38     # Documents
39     url(r'^documents$', library_resource,
40         {'emitter_format': 'json'}, name="document_list_view"),
41
42     url(urlpath(r'documents'), library_resource,
43         name="document_list_view_withformat"),
44         
45     #url(urlpath(r'documents', DOC),
46     #    document_resource, name="document_view_withformat"),
47
48     url(urlpath(r'documents', DOC, format=False),
49         document_resource, {'emitter_format': 'json'},
50         name="document_view"),
51
52     url(urlpath(r'documents', DOC, 'gallery', format=False),
53         document_gallery, {'emitter_format': 'json'},
54         name="docgallery_view"),
55
56     # XML    
57     url(urlpath(r'documents', DOC, 'text', format=False),
58         document_text_resource, {'emitter_format': 'raw'},
59         name="doctext_view"),
60
61     # HTML
62     url(urlpath(r'documents', DOC, 'html', format=False),
63         document_html_resource, {'emitter_format': 'raw'},
64         name="dochtml_view"),
65
66     # DC
67     #url(urlpath(r'documents', DOC, 'dc'),
68     #    document_dc_resource,
69     #    name="docdc_view_withformat"),
70
71     url(urlpath(r'documents', DOC, 'dc', format=False),
72         document_dc_resource, {'emitter_format': 'json'},
73         name="docdc_view"),
74
75     # MERGE
76     url(urlpath(r'documents', DOC, 'revision', format=False),
77         document_merge, {'emitter_format': 'json'}, name="docmerge_view")
78
79 #    url(r'^documents/(?P<docid>[^/]+)/parts$',
80 #        document_resource, {'emitter_format': 'json'},
81 #        name="docparts_view"),
82         
83   #  url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource),
84   #  url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource),
85 )
86