Browse Source

Int-ify timestamps.

master
Ben Kurtovic 8 years ago
parent
commit
181f54e618
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      calefaction/auth.py

+ 2
- 2
calefaction/auth.py View File

@@ -27,7 +27,7 @@ class AuthManager:
"""Create a new session for the current user.""" """Create a new session for the current user."""
sid, created = g.db.new_session() sid, created = g.db.new_session()
session["id"] = sid session["id"] = sid
session["date"] = created.replace(tzinfo=timezone.utc).timestamp()
session["date"] = int(created.replace(tzinfo=timezone.utc).timestamp())
self._debug("Allocated session id=%d", sid) self._debug("Allocated session id=%d", sid)
g._session_check = True g._session_check = True
g._session_expired = False g._session_expired = False
@@ -79,7 +79,7 @@ class AuthManager:
g._session_check = False g._session_check = False
return False return False


cstamp = created.replace(tzinfo=timezone.utc).timestamp()
cstamp = int(created.replace(tzinfo=timezone.utc).timestamp())
if session["date"] != cstamp: if session["date"] != cstamp:
self._debug("Clearing bad-date session id=%d", session["id"]) self._debug("Clearing bad-date session id=%d", session["id"])
session.clear() session.clear()


Loading…
Cancel
Save