From 1f61bf3134f3b46954ad012096c6ff3b398a74ef Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 5 Feb 2012 16:50:57 +0100 Subject: [PATCH] Use the environment to configure session and skel defaults as well. --- wrw/resp.py | 6 +++--- wrw/session.py | 6 +++--- wrw/util.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wrw/resp.py b/wrw/resp.py index 9d8542b..3514616 100644 --- a/wrw/resp.py +++ b/wrw/resp.py @@ -1,4 +1,4 @@ -import dispatch, proto +import dispatch, proto, env __all__ = ["skeleton", "skelfor", "setskel", "usererror"] @@ -27,10 +27,10 @@ class skeleton(object): def message(self, message, detail): return self.page(message, """

%s

\n

%s

\n""" % (message, detail)) -defskel = skeleton() +defskel = env.var(skeleton()) def getskel(req): - return [defskel] + return [defskel.val] def skelfor(req): return req.item(getskel)[0] def setskel(req, skel): diff --git a/wrw/session.py b/wrw/session.py index 7632449..1239ecd 100644 --- a/wrw/session.py +++ b/wrw/session.py @@ -1,5 +1,5 @@ import threading, time, pickle, random, os -import cookie +import cookie, env __all__ = ["db", "get"] @@ -180,7 +180,7 @@ class dirback(object): with open(os.path.join(self.path, key), "w") as out: out.write(value) -default = db(backdb = dirback(os.path.join("/tmp", "wrwsess-" + str(os.getuid())))) +default = env.var(db(backdb = dirback(os.path.join("/tmp", "wrwsess-" + str(os.getuid()))))) def get(req): - return default.get(req) + return default.val.get(req) diff --git a/wrw/util.py b/wrw/util.py index b94564b..6170c9e 100644 --- a/wrw/util.py +++ b/wrw/util.py @@ -50,7 +50,7 @@ class sessiondata(object): @classmethod def sessdb(cls): - return session.default + return session.default.val class autodirty(sessiondata): @classmethod -- 2.11.0