[Zope] Session transferring problem
Chris McDonough
chrism@zope.com
16 Apr 2003 10:44:17 -0400
Hi Lubos.
As Oliver guessed, this is indeed a problem with the BASE tag generated
by Zope. This is a bug.
To work around it, you can include an explicit BASE tag in index_html:
<html>
<head>
<base href="" tal:attributes="href request/URL0"/>
<title tal:content="template/title">The title</title>
</head>
<body>
<span tal:content="structure here/content"></span>
</body>
</html>
I *wanted* to say tal:attributes="href here/absolute_url" in the base
tag above, but this doesn't do the right thing for some reason.
- C
On Wed, 2003-04-16 at 10:05, Lubos Culen wrote:
> Chris,
>
> thank you very much for detailed answer. I investigated a bit, and I think
> the issue is here:
>
> Let's say I have DTML document called 'content' in folder 'document'. Let's
> say I have link <a href="testlink">testlink</a> inside this "content"
> document.
>
> Now, when I'm accessing *directly* the 'content' document from the web (e.g.
> http://www.mysite.com/document/content ), then the link is right encoded
> with Zope's session ID, exactly as you explained.
>
> BUT - when I'm accessing this 'content' document *indirectly* (for example,
> through some ZPT Page template), then the URL session will not be
> maintained. Here is concrete example when this happens: if I create Page
> Template at http://www.mysite.com/index_html , which will read the "content"
> inside (using <span tal:content="structure here/content"></span>), and if I
> will call http://www.mysite.com/document/ , it will display the "content"
> document correctly, but the <a href="testlink"> it will translate without
> session data. I tried also DTML Methods for templates instead of ZPT, but
> the result was the same.
>
> During all the process, I have "Automatically Encode Zope-Generated URLs
> With A Browser Id" in browser_id_manager switched off.
>
> Do you have any suggestions?
>
> Thanks,
>
> Lubos.
>
> > -----Original Message-----
> > From: Chris McDonough [mailto:chrism@zope.com]
> > Sent: 16. dubna 2003 15:32
> > To: Lubos Culen
> > Cc: Zope mailinglist
> > Subject: Re: [Zope] Session transferring problem
> >
> >
> > Hi Lubos,
> >
> > I unfortunately can't replicate this behavior.
> >
> > As long as you've got the "automatically encode Zope-generated URLs with
> > a browser id" parameter checked off in your browser id manager, and as
> > long as you don't provide *absolute* urls in your links, the URLs
> > rendered by the browser should indeed include the URL fragments which
> > identify the session.
> >
> > OTOH, if you are providing absolute links in the content (links
> > beginning with a '/' or links that include a protocol like "http://" in
> > them), the browser will not take into account the base url of the page
> > and the link will be rendered as written.
> >
> > Eg:
> >
> > <a href="testlink">testlink</a>
> >
> > becomes a link to:
> >
> > http://localhost:8080/_ZopeId/30629499A0xKIYXTE4A/testlink
> >
> > <a href="/testlink">absolute testlink</a>
> >
> > becomes a link to:
> >
> > http://localhost:8080/testlink
> >
> > <a href="http://testlink">absolute testlink with protocol</a>
> >
> > becomes a link to:
> >
> > http://testlink
> >
> > If you see something different, please let me know.
> >
> > - C
> >
> >
> > On Wed, 2003-04-16 at 08:19, Lubos Culen wrote:
> > > Hi,
> > >
> > > I have a page with session data transferring through the URLs,
> > so the page
> > > URLs in browser look like
> > > http://www.mysite.com/_ZopeId/84525053A0xJuPCpTSI/mydir/mydocument.
> > >
> > > Now, let's have DTML document called "content" inside the "mydocument"
> > > folder, which contains some "static" HTML data (this data
> > cannot be DTML,
> > > because it needs to be editable with some WYSIWYG editor). Above these
> > > folders is some ZPT template called index_html, which will display the
> > > content data inside the some template.
> > > Let's have some link in the "mydocument/content" document, which is for
> > > example <a href="other_document">Link</a> . It is inside the
> > content area
> > > and it is linked *relatively*, so I suppose it should maintain
> > the session
> > > data (so the Zope's result URL would be
> > >
> http://www.mysite.com/_ZopeId/84525053A0xJuPCpTSI/mydir/other_document ).
> > But the reality is bad - result URL is only
> > http://www.mysite.com/mydir/other_document and the session data is lost.
> >
> > So, the question is, is there *any* way how to maintain URL sessions when
> > linking relatively inside plain content (non-DTML and non-ZPT) document in
> > Zope? Or, if not, how people use to solve this problem generally, when
> need
> > to transfer non-cookie session data through static <a href="..."> URLs?
> >
> > Thanks for the answer,
> >
> > Lubos.
> >
> >
> > _______________________________________________
> > Zope maillist - Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
>