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
10 """converts a datetime.datetime object to a timestamp int"""
11 return int(mktime(dtime.timetuple()))
14 class CsrfExemptResource(Resource):
15 """A Custom Resource that is csrf exempt"""
16 def __init__(self, handler, authentication=None):
17 super(CsrfExemptResource, self).__init__(handler, authentication)
18 self.csrf_exempt = getattr(self.handler, 'csrf_exempt', True)