1 import req, dispatch, session
3 def wsgiwrap(callable):
4 def wrapper(env, startreq):
5 return dispatch.handle(req.origrequest(env), startreq, callable)
8 def persession(data = None):
11 sess = session.get(req)
12 if callable not in sess:
14 sess[callable] = callable()
18 sess[callable] = callable(data)
19 return sess[callable].handle(req)
23 class sessiondata(object):
26 sess = cls.sessdb().get(req)
37 return session.default
39 class autodirty(sessiondata):
42 ret = super(autodirty, cls).get(req)
43 if "_is_dirty" not in ret.__dict__:
44 ret.__dict__["_is_dirty"] = False
47 self.__dict__["_is_dirty"] = False
52 def __setattr__(self, name, value):
53 super(autodirty, self).__setattr__(name, value)
54 if "_is_dirty" in self.__dict__:
55 self.__dict__["_is_dirty"] = True
57 def __delattr__(self, name):
58 super(autodirty, self).__delattr__(name, value)
59 if "_is_dirty" in self.__dict__:
60 self.__dict__["_is_dirty"] = True