X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/60b06883b6d5a336ef47c01103ec1ce25aafae69..6c916ba46721835a11f260fc9b3b7db9727dcf42:/apps/api/helpers.py?ds=sidebyside diff --git a/apps/api/helpers.py b/apps/api/helpers.py index aa22465fc..acb491afc 100644 --- a/apps/api/helpers.py +++ b/apps/api/helpers.py @@ -1,8 +1,14 @@ # -*- coding: utf-8 -*- from time import mktime +from piston.resource import Resource def timestamp(dtime): "converts a datetime.datetime object to a timestamp int" return int(mktime(dtime.timetuple())) +class CsrfExemptResource(Resource): + """A Custom Resource that is csrf exempt""" + def __init__(self, handler, authentication=None): + super(CsrfExemptResource, self).__init__(handler, authentication) + self.csrf_exempt = getattr(self.handler, 'csrf_exempt', True)