X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/fa5a185ce54eb7bacaadc34f05abb63e701d39d8..dc30a4e658e49999b03271256c477bcad1f4f955:/apps/api/helpers.py?ds=sidebyside

diff --git a/apps/api/helpers.py b/apps/api/helpers.py
index f01522aa7..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 with fractional part"
-    return mktime(dtime.timetuple()) + dtime.microsecond / 1000000.0
+    "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)