Julian Ciccale
jciccale at mac.com
Mon Nov 24 10:44:17 EST 2003
Thanks, BTW the "lock" argument its only available through BaseSession's __init__ and not DbmSession/MemorySession. It would be interesting to have it.. There are cases where you may want to request be processed at the same time for the same session, for example if the users calls a pdf generating page and at the same time he opens another browser win to do soma other stuff. It seems that my problem would be the scope stuff cause I dont get my data saved even by unlocking the session. By now I've made a work around by calling unlock & save when the request is done Thanks, Julian I removed the definitions and I'm using directly mod_python's Session object. then action On Monday, November 24, 2003, at 05:25AM, Gregory (Grisha) Trubetskoy <grisha at modpython.org> wrote: > > >On Mon, 24 Nov 2003, Julian Ciccale wrote: > >> Kind of. What I do is the followoing >> >> try: >> from mod_python.Session import Session as DefaultSessionCall >> except: >> def DefaultSessionCall( r ): >> return None >> >> , this is a peice of code I use to make configurable the Session class >> the user wants to use. > >This is fine, but make sure that after you do: > > session = DefaultSessionCall(r) > >that the session variable is not referenced by anything after the request >is done. Or you can explicitely unlock it: > > session.unlock() > >> I also then try to call a setter method on a user's class to pass the >> session he works on. How should I use the session? The locking mechanism >> is needed for read/write or just write? > >You don't need to worry about locking for read and write, that locking is >taken care of automtically. You need session locking to make sure that no >two HTTP requests for the same session execute at the same time. > >> I think I may write a session wrapper class to lock unlock on user call >> to get/set properties.. > >Your wrapper can avoid session locking altogether by instantiating it as >such: > >session = Session(req, lock=0) > >Grisha > >
|