From 4136f320917de125eda1941497609aae57e2cf66 Mon Sep 17 00:00:00 2001 From: Seth Schoen Date: Tue, 3 Jul 2012 00:55:53 -0700 Subject: [PATCH] expressions in Python function definition default values are evaluated only once, when the functions are defined --- client-webserver/chocolate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client-webserver/chocolate.py b/client-webserver/chocolate.py index 7b9999bd0..63b8672aa 100755 --- a/client-webserver/chocolate.py +++ b/client-webserver/chocolate.py @@ -74,7 +74,8 @@ class session(object): # a challenge, we have state="testchallenge", but live="False". return sessions.hget(self.id, "state") - def create(self, timestamp=int(time.time())): + def create(self, timestamp=None): + if timestamp is None: timestamp = int(time.time()) if not self.exists(): sessions.hset(self.id, "created", timestamp) sessions.hset(self.id, "live", True)