From: Fredrik Tolf Date: Fri, 30 Dec 2011 01:43:55 +0000 (+0100) Subject: Added a way to get sessiondata without creating it. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=8f911ff6836b3324b83572182b87130939953100;p=wrw.git Added a way to get sessiondata without creating it. --- diff --git a/wrw/util.py b/wrw/util.py index 7a29ea8..b94564b 100644 --- a/wrw/util.py +++ b/wrw/util.py @@ -36,12 +36,14 @@ def persession(data = None): class sessiondata(object): @classmethod - def get(cls, req): + def get(cls, req, create = True): sess = cls.sessdb().get(req) with sess.lock: try: return sess[cls] except KeyError: + if not create: + return None ret = cls(req) sess[cls] = ret return ret