From 8f911ff6836b3324b83572182b87130939953100 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Fri, 30 Dec 2011 02:43:55 +0100 Subject: [PATCH] Added a way to get sessiondata without creating it. --- wrw/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.11.0