Dolda2000 GitWeb
/
wrw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bbdebba
)
Added a way to get sessiondata without creating it.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 30 Dec 2011 01:43:55 +0000
(
02:43
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 30 Dec 2011 01:43:55 +0000
(
02:43
+0100)
wrw/util.py
patch
|
blob
|
blame
|
history
diff --git
a/wrw/util.py
b/wrw/util.py
index
7a29ea8
..
b94564b
100644
(file)
--- a/
wrw/util.py
+++ b/
wrw/util.py
@@
-36,12
+36,14
@@
def persession(data = None):
class sessiondata(object):
@classmethod
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:
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
ret = cls(req)
sess[cls] = ret
return ret