[Zope] Session transferring problem
Lubos Culen
mirsoft@systinet.com
Thu, 17 Apr 2003 09:22:25 +0200
Chris,
I see there was a bit misunderstanding in 'checked off' - I meant
'unchecked' :) I checked it on and it behaves as you wrote already. However,
I will submit an bug issue into the bug collector.
Thanks,
-Lubos.
> -----Original Message-----
> From: Chris McDonough [mailto:chrism@zope.com]
> Sent: 16. dubna 2003 19:26
> To: Lubos Culen
> Cc: Zope mailinglist
> Subject: RE: [Zope] Session transferring problem
>
>
> Lubos,
>
> The workaround I gave does indeed work for the specific example you gave
> in the last email. I'm not sure how it behaves under other
> circumstances. I am not really sure there is a workaround that is
> completely general.
>
> In the first example you give below where you tried URL0, it sounds like
> you either visited the folder without the session data in the URL or
> don't have URL munging turned on in the browser id manager.
>
> (Just in case: I may have been unclear when I said "make sure the
> 'automatically generate...' box is 'checked off'" in the last email, I
> mean make sure that the "automatically generate..." checkbox is
> *checked*.)
>
> The actual fix for the bug is to fix the BASE tag rendering. I've looked
> at the code but haven't found a straightforward fix for it, and I'm out
> of time.
>
> I'd suggest entering this issue into the bug collector at
> collector.zope.org so we don't forget about it
>
> - C
>
>
> On Wed, 2003-04-16 at 13:07, Lubos Culen wrote:
> > Chris,
> >
> > I tried this, but it does doesn't seem to work.
> >
> > Using the <base href="" tal:attributes="href request/URL0"/>
> >
> > it generates:
> >
> > <base href="http://localhost:8080/path/to/www/index_html/" />
> >
> > (without session data, and the "<a href="testlink">" is not translated)
> >
> >
> > I tried also <base href="" tal:attributes="href request/PATH_INFO"/>
> > which displayed the session data when called, but it now displayed only
> > <base href="/_ZopeId/98484417A0xKnA7xHio/path/to/www" />
> > - which means that after clicking a link it went to a level
> higher and it
> > did not find it.
> >
> > Using this, I played with it a used more with combinations for href
> > replacements like:
> >
> > - string:${request/SERVER_URL}${request/PATH_INFO}
> > - string:${request/SERVER_URL}${request/PATH_INFO}/
> > - string:${request/SERVER_URL}${request/PATH_INFO}/index_html
> >
> > , but I have not found any solution, which would be completely
> stable and
> > compatible. If it works for you, could you possibly send me a *.zexp
> > example, which I could inspire from?
> >
> > Thanks and regards, Lubos.
> >
> > > -----Original Message-----
> > > From: Chris McDonough [mailto:chrism@zope.com]
> > > Sent: 16. dubna 2003 16:44
> > > To: Lubos Culen
> > > Cc: Zope mailinglist
> > > Subject: RE: [Zope] Session transferring problem
> > >
> > >
> > > 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 )
> >
>