Martijn Pieters <mj@antraciet.nl> wrote:
At 22:25 24-10-99 , Avus wrote:
Hi,
how do I transfer session (or authentication) information from a non-Zope site (PHP or else) to a Zope site?
Cookies just work on the same site, hidden fields just work for 'post's. So I'll probably have to pass the information in the URL. My Q: How do I get Zope to strip and evaluate the id information I pass in the URL string, even if the Zope object I'm calling is not explicitly prepared to do that (i.e. it is no DTML method that has code for this)? Zope URLs are often created on the fly (db query), so the handling of the id string in the URL has to be acquired by some inheritance magic, I guess.
Any ideas how to solve this? The inted is that the user doesn't have to login twice (the session id could be stored in a common db).
You could use __bobo_traverse__ or __get_item__ for this. It'll enable URLs
like:
http://your.zope.server/Session/0x1234/SQLMethod/city/New%20York/
where Session is an instance of a Python class you've written. It's __bobo_traverse__ method will be called with the 0x1234 part of the URL and
the REQUEST object, while __get_item__ will only get the 0x1234 part. See lib/python/Shared/DC/ZRDB/DA.py for an example, the second part of my example URL is implemented there (ZSQL Methods support direct traversal).
So the Session class handles the session ID (i.e. maps it to a particular user, for example), right? Any object to the right of the Session object would have to be traversable (is this always the case?). If I want to keep the site structure, I also want to have the session object call the original URL after authenticating. http://zope.server/Session/0x1234/stuff/info/abc should call the original http://zope.server/stuff/info/abc so I need some redirector logic as well. And then it's easier for the 'calling site' to encode the session id like http://zope.server/stuff/info/abc?id=0x123 than to put it in the middle of an URL string. Is there a way to inherit the capability to handle 'get' (id) parameters in random Zope objects? Avus ____________________________________________________________________ Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.