Graham Dumpleton wrote ..
> Next option is to use a wrapper class and you wrap every function that
> wants to
> be able to use sessions:
>
> class SessionEnabled:
> def __init__(self, target):
> self.__target = target
> def __call__(self):
> return util.apply_fs_data(self.__target, req.form)
>
> def _function(req, a, b):
> return a,b
>
> function = SessionEnabled(_function)
Whoops forgot to create the session.
class SessionEnabled:
def __init__(self, target):
self.__target = target
def __call__(self):
if not hasattr(req, 'session'):
req.session = Session.Session(req)
return util.apply_fs_data(self.__target, req.form)
Graham