Merge branch 'master' of stigma.nowoczesnapolska.org.pl:platforma
[redakcja.git] / apps / api / utils.py
1 # -*- encoding: utf-8 -*-
2
3 __author__= "Ɓukasz Rekucki"
4 __date__ = "$2009-09-20 21:48:03$"
5 __doc__ = "Module documentation."
6
7
8 from piston.emitters import Emitter
9 from piston.utils import rc
10
11 class TextEmitter(Emitter):
12     def render(self, request):
13         return unicode(self.construct())
14
15 Emitter.register('text', TextEmitter, 'text/plain; charset=utf-8')
16 Emitter.register('rawxml', TextEmitter, 'application/xml; charset=utf-8')
17
18
19 class DjangoAuth(object):
20
21     def is_authenticated(self, request):
22         return request.user.is_authenticated()
23
24     def challenge(self):
25         return rc.FORBIDDEN