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
48 self.__dict__["_is_dirty"] = False
53 def __setattr__(self, name, value):
54 super(autodirty, self).__setattr__(name, value)
55 if "_is_dirty" in self.__dict__:
56 self.__dict__["_is_dirty"] = True
58 def __delattr__(self, name):
59 super(autodirty, self).__delattr__(name, value)
60 if "_is_dirty" in self.__dict__:
61 self.__dict__["_is_dirty"] = True
63 class manudirty(object):
64 def __init__(self, *args, **kwargs):
65 super(manudirty, self).__init__(*args, **kwargs)