[mod_python] servlet

Daniel Popowich dpopowich at comcast.net
Fri Jul 30 14:50:16 EDT 2004


> 3) this is only for confirm:
>  
> I already have a Session instance from publischer program, and the function
> made a lot of other work..
>  
> So in order to use my function on servlet a workaround may be:
>  
>  
> class willybase(HTMLPage):
>     py = {}
>     use_session = False   <------------------------
>     
>     def prep(self):
>         HTMLPage.prep(self) 
>         self.session = adatta_ha.sessione(self.req,....) <--------
>         self.use_session=True   <------------
>         ........
>  
> In this way cleanup_session etc.. I think will work fine, and I have the
> same function called from publisher and servlet
> I'm right?

Actually, I just thought of a problem.  Servlet instances span
requests, so when you set self.use_session = True in your prep()
method, then it will be True for the next request, as well.  You
probably want this:

     def prep(self):
     	 self.use_session = False
         HTMLPage.prep(self) 
         self.session = adatta_ha.sessione(self.req,....)
         self.use_session=True

Make sense?
	 
Daniel	 



More information about the Mod_python mailing list