1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from time import mktime
6 from piston.resource import Resource
9 "converts a datetime.datetime object to a timestamp int"
10 return int(mktime(dtime.timetuple()))
12 class CsrfExemptResource(Resource):
13 """A Custom Resource that is csrf exempt"""
14 def __init__(self, handler, authentication=None):
15 super(CsrfExemptResource, self).__init__(handler, authentication)
16 self.csrf_exempt = getattr(self.handler, 'csrf_exempt', True)