4b004ee90df710ba9d42b12ac327568656b76d5b
[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 class DjangoAuth(object):
19
20     def is_authenticated(self, request):
21         return request.user.is_authenticated()
22
23     def challenge(self):
24         return rc.FORBIDDEN