[Zope] Aquisition problem with Cookies?

Christian Scholz cs@comlounge.net
Sun, 30 Apr 2000 01:43:16 +0200


Hi!

I recently played around with SQLSession backed by a mysql database.
My setup was the following:

    mysite/
    mysite/std_header_html	    DTML document
    mysite/std_footer_html	    DTML document
    mysite/index_html		    DTML document
    mysite/Session		    SQL Session
    mysite/folder/index_html	    DTML document


The idea is to do all the session stuff in the sql_header_html, basically
doing the <dtml-call Session>.

Being in mysite/index_html everything works. The Session is created and
when logging in via a form the actual userid is stored in the Session_Data.

Now when jumping to mysite/folder/index_html it's not working anymore.
I am again using a <dtml-var std_header_html> at the beginning which 
aquires the dtml document in the parent folder. The problem is now that
a new session is created all the time although one should be still available 
when accessing mysite/folder/index_html (thus the cookie should still be 
available in the request).

When moving the <dtml-call Session> into mysite/folder/index_html 
everything works.

So why is this?

To track it down a little more I checked which cookies are stored
in REQUEST.cookies. I did this in std_header_html and mysite/folder/index_html:

std_header_html:

<dtml-in "REQUEST.cookies.keys()">
<dtml-var sequence-item> = <dtml-var "REQUEST.cookies[_['sequence-item']]"><br>
</dtml-in>

and the same in mysite/folder/index_html:

<dtml-in "REQUEST.cookies.keys()">
<dtml-var sequence-item> = <dtml-var "REQUEST.cookies[_['sequence-item']]"><br>
</dtml-in>
<dtml-call Session>
<dtml-var std_header_html> 

I would expect that both loops would produce the same output but it isn't.
In the loop in mysite/folder/index_html the cookie is there and in the loop
done by std_header_html it isn't. So this seems to be the reason why always
a new session is created when only doing the session work in the std_header_html.

Can someone explain this to me? ;-)
(Actually putting the Session call into index_html is not the problem but
 for modularizing things I would like it more to be in a central place.)

Hope someone knows more than I do :)

-- christian