[Zope] Session data in URL *or* in cookie
Dieter Maurer
dieter@handshake.de
Wed, 26 Feb 2003 20:08:09 +0100
Lubos Culen wrote at 2003-2-26 11:34 +0100:
> thank you very much for answer - I see I will have to encode the URLs
> "manually" when user has not cookies enabled. But yet one more question:
> Now I'm using the function encodeUrl, which transfers URL to something like
> http://foo.com/amethod?_ZopeId=as9dfu0adfu0ad . But - is in Zope any
> similar function, which will encode the URLs in a way
> http://foo.com/_ZopeId/as9dfu0adfu0ad/amethod (exactly as automated URL-
> encoding engine does it) ? This encoding has big advantage that the session
> will remain when relative links are used, so I would find very handy if I
> could encode the session data this way.
I do not know a function that does precisely this.
The problem is that for *relative* URLs it may not be easy to
know the URL path segments before the given part.
As you want to add a starting path, you must effectively
make the relative URL an absolute one.
For absolute URLs, the problem is quite straight forward:
You recognize the protocol and host part, if any, and remove
it.
You prepend the new segments.
You prepend the protocol and host part again (if any).
Dieter