librarian<1.2 compatibility fix
[wolnelektury.git] / apps / api / urls.py
1 # -*- coding: utf-8 -*-
2 from django.conf.urls.defaults import *
3 from piston.resource import Resource
4 from piston.authentication import HttpBasicAuthentication
5
6 from api.handlers import BookHandler
7
8
9 auth = HttpBasicAuthentication(realm='My sample API')
10 book_resource = Resource(handler=BookHandler, authentication=auth)
11
12
13 urlpatterns = patterns('',
14     url(r'^books/(?P<slug>[^/]+)\.(?P<emitter_format>xml|json|yaml)$', book_resource),
15     url(r'^books\.(?P<emitter_format>xml|json|yaml)$', book_resource),
16 )
17