Hello, I have problems with traversal and the default Zope session data manager. My goal is to have many session data managers and a 'router' object that (when traversed) routes a user's web request to a new path that traverses the right session data manager (and thus makes it set the lazy object SESSION, if it is referenced in the original request). To achieve this, I wrote a SimpleItem class (called Prova for now) with a __bobo_traverse__ method that does nothing but returning an unrestrictedTraverse on the new path (which is the original one splitted in the middle and joined with the path that traverses the session data manager of interest). To make an example, let's say I put a bunch of session data managers each in a folder named /mySite/sdm#Folder. If the original request was: /mySite/folder1/prova/myDTMLMethod where myDTMLMethod sets the SESSION object, the Prova object (the router), when traversed, decides that session data manager #1 should handle this session, and returns: unrestrictedTraverse('/mySite/sdm1Folder/folder1/prova/myDTMLMethod') Unfortunately, this doesn't work: the SESSION object is not (lazily) appended to the REQUEST, but I can't figure out why. Also, I don't know if this is the right way of implementing the behaviour described above or should I use response.redirect() instead. I tried the first scheme by hand, as well, calling directly the URL /mySite/sdm1Folder/folder1/myDTMLMethod from a web browser and everything works fine: this time the SESSION object is created and appended to REQUEST. Thanks in advance for kindly helping, cheers, Mario. _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com
Mario Bianchi wrote:
To achieve this, I wrote a SimpleItem class (called Prova for now) with a __bobo_traverse__ method that does nothing but returning an unrestrictedTraverse on the new path (which is the original one splitted in the middle and joined with the path that traverses the session data manager of interest).
I'm not sure your __bobo_traverse__ is doing what it should :-S
Unfortunately, this doesn't work: the SESSION object is not (lazily) appended to the REQUEST, but I can't figure out why.
Because I don't think __bobo_traverse__ works as you expect, but I can't remember off the top of my head how it does work. Have a look at REQUEST.steps to see what names you have traversed and check your session data manager is being covered.
Also, I don't know if this is the right way of implementing the behaviour described above or should I use response.redirect() instead.
might be simpler... Have a look at the PathHandler product to see how __bobo_traverse__ hooks actually work and see if you can make it fit your model... cheers, Chris
participants (2)
-
Chris Withers -
Mario Bianchi