| author | raph |
| Mon, 12 Jul 2010 13:53:26 +0200 | |
| changeset 288 | c6fe4822a243 |
| parent 287 | fc5ed157ebfe |
| child 293 | 2c52e4453bf7 |
| permissions | -rw-r--r-- |
|
287
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
1 |
from django.conf.urls.defaults import * |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
2 |
|
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
3 |
from piston.resource import Resource |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
4 |
from piston.authentication import HttpBasicAuthentication |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
5 |
|
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
6 |
from cm.api.handlers import * |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
7 |
auth = HttpBasicAuthentication(realm='Comt API') |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
8 |
|
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
9 |
text_handler = Resource(handler=TextHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
10 |
textversion_handler = Resource(handler=TextVersionHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
11 |
text_list_handler = Resource(handler=TextListHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
12 |
text_delete_handler = Resource(handler=TextDeleteHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
13 |
text_pre_edit_handler = Resource(handler=TextPreEditHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
14 |
text_edit_handler = Resource(handler=TextEditHandler, authentication=auth) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
15 |
setuser_handler = Resource(handler=SetUserHandler, authentication=None) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
16 |
|
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
17 |
#doc_handler = Resource(handler=DocHandler) |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
18 |
|
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
19 |
urlpatterns = patterns('', |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
20 |
url(r'^text/(?P<key>\w*)/$', text_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
21 |
url(r'^text/$', text_list_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
22 |
url(r'^text/(?P<key>\w*)/delete/$', text_delete_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
23 |
url(r'^text/(?P<key>\w*)/pre_edit/$', text_pre_edit_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
24 |
url(r'^text/(?P<key>\w*)/edit/$', text_edit_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
25 |
url(r'^text/(?P<key>\w*)/(?P<version_key>\w*)/$', textversion_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
26 |
url(r'^setuser/$', setuser_handler), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
27 |
url(r'^doc/$', documentation), |
|
fc5ed157ebfe
add api: basic auth / unit tests / online doc (based on django-piston)
raph
parents:
diff
changeset
|
28 |
) |