Skip to content

Commit

Permalink
修改py2.6不支持delta_seconds的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
phith0n committed Aug 20, 2015
1 parent 9cdcca5 commit 165eae4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions extends/torndsession/redissession.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def save(self, session_id, session_data, expires=None):
self.__create_redis_client()
self.client.set(session_id, session_data)
if expires:
delta_seconds = int((expires - datetime.utcnow()).total_seconds())
self.client.expire(session_id,delta_seconds)
td = expires - datetime.utcnow()
delta_seconds = int((td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6)
self.client.expire(session_id, delta_seconds)

def clear(self, session_id):
self.__create_redis_client()
Expand Down

0 comments on commit 165eae4

Please sign in to comment.