Hi Jose! Now I´m confused, I thought one was supposed to delete the sessions at the beginning of the controller function in question, does putting the call in base.py eliminate the need to add del calls in every controller function?
Thanks On Aug 8, 5:33 am, jose <[EMAIL PROTECTED]> wrote: > Dear Max, > > I just found out that we should be deleting the current session in > base.py. So in > > base.py you should have > > del model.sac.session_context.current > > which effectively would "clear" the session which is what I think you > wanted from your original post See the thread that I started about > the wrong data being returned in my application (http:// > groups.google.com/group/pylons-discuss/browse_frm/thread/ > a8741d398aede8f5) > > Jose > > On Aug 7, 2:04 am, "Max Ischenko" <[EMAIL PROTECTED]> wrote: > > > Hello Mike, > > > On 8/3/07, Mike Orr <[EMAIL PROTECTED]> wrote: > > > > > Is it optimal setup? What if make a DatabaseFacade created just once, > > > > instead of per-request? Would it remain thread-safe? > > > > No. sac.session is the session appropriate to the current thread (and > > > application for multi-app sites). You'd be saving a session in one > > > thread and using it in another thread. Worse, the session you clear > > > in the base controller would be different than the session used by a > > > DatabaseFacade method. > > > Thanks for the explanation, I see your point. > > > Are you sure you need a DatabaseFacade class? If there's only one > > > > instance, it's the same as a module. So you can recast your > > > high-level access methods as functions: > > > Yep, that's one approach. I wanted a DatabaseFacade class so I can stub its > > interface for testing. > > > I suppose if I just make it stateless (see below) it will work nicely: > > > class DatabaseFacade(object): > > def __init__(self): > > self.meta = sac.get_metadata("blog") # also a shortcut > > > session = property(fget=lambda self: sac.session) > > > Max. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---