[Zope] Core Session Tracking kudos & namespaces

Tres Seaver tseaver@digicool.com
Sun, 07 Jan 2001 23:47:56 -0500


"Chris McDonough" <chrism@digicool.com> wrote

<snip>

> I think the idiom here will be:
> 
> <dtml-with "datamgr.getSessionData()" mapping>
>    <dtml-var foo>
> </dtml-with>
> 
> > But I don't see how to do that, because if I
> > stick a dtml-with, for instance, into generic header code
> > (included, for example, by standard-html-header, then this
> > with statement is required to be *closed* when I edit it).
> 
> Yeah, the split between header and footer is unfortunate
> right now... one way to have the stuff  available in all
> your documents would be to use the request namespace in the
> header:
> 
> <dtml-let data=sessiondatamgr.getSessionData()">
>     <dtml-call "REQUEST.set(data, 'sessiondata')">
> </dtml-let>
> 
> ...then in the rest of your documents, you could refer to
> sessiondata:
> 
> <dtml-let data="REQUEST['sessiondata']">
> ....
> </dtml-let>
> 
> This is not particularly encouraged.  Hopefully the upcoming
> HiperDOM will solve the header/footer split problem.

I think a cleaner near-term workaround is to have the standard
header explicitly copy all the session key-variable pairs into
REQUEST.other:

 <dtml-in "sessiondatamgr.getSessionData().items()">
  <dtml-let k=sequence-key v=sequence-value>
   <dtml-call "REQUEST.set( k, v )">
  </dtml-let>
 </dtml-in>

(This presumes that the getSessionData() return value supplies
an items() method, which I haven't actually checked).

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org