[Zope] Q: How to pass session information from outside
into Zope?
Martijn Pieters
mj@antraciet.nl
Mon, 25 Oct 1999 07:45:31 +0200
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).
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------