On Wednesday 05 March 2003 20:40, you wrote: > I agree with the issue about confusing the beginner with a redirection > like that. Though, if you really want to, you could use a proxy and > not muck with changing the getattr and setattr methods of the servlet, > or the session:
Are you sure that a servlet variable is used for one and only one instance between "awake" and "sleep"? Even if it is the behaviour now, won't it change in the future? If, on the other hand, it can be assured that a servlet stays "clean" between awake and sleep, your solution is very elegant indeed and could be easily extended to be used for requests as well :-) Stephan > > #------ begin Test.py > > from WebKit.Page import Page > > class Test(Page): > > def awake (self, transaction): > Page.awake(self, transaction) > self.session = SessionProxy(self.session()) > self.session.x = range(20) > > def writeContent (self): > self.write(str(self.session.x)) > > class SessionProxy: > def __init__ (self, session): > self.__dict__['session'] = session > def __getattr__ (self, attr): > return self.__dict__['session'].value(attr) > def __setattr__ (self, attr, value): > self.__dict__['session'].setValue(attr, value) > > #--- end Test.py > ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
