[Zope] CoreSessionTracking's get looped in <dtml-in> does not work?

Chris McDonough chrism@digicool.com
Tue, 07 Aug 2001 08:33:54 -0400


Milos Prudek wrote:
> 
> Dne pondělí 06 srpen 2001 15:32 jste napsal(a):
> > How about:
> >
> > <dtml-let "a=data.get('writers')">
> >   <dtml-var "display(a)">
> > </dtml-let>
> >
> > Where display is:
> >
> > display (Python Script)
> > arguments: data
> >
> > return data.get('fname')
> 
> I can't test it now... I'm at Zope 2.4 machine, and CoreSessionTracking 0.8
> doesn't work with it.

It will work with it if you delete the line "id = 'session_id_mgr'" in
the SessioningInterfaces.py file.  A new version will be out soon.

> It looks good but I need to iterate using <dtml-in>...  because I need a
> construct "<dtml-unless sequence-end>, </dtml-unless>"

Ummm.. ok.


> What you wrote does not look like iteration. The a variable receives a set of
> records... display Script is called with "a" parameter... fname is extracted
> from session data... but which fname, if there are many records? And what you
> wrote is a nested session extraction?? (first extract writers, then
> sub-extract fname?)

OK, I've forgotten what the original problem was.  ;-)  But you may want
to convert the record object out into a dictionary before you store it
in CST, that way you can be sure of what you're operating against.

> You are right that when I pass the :records as a parameter I can iterate
> through it. However I cannot change values inside :records... unless I apply
> the patch suggested recently by Evan Simpson. If I do not want to patch, I
> need to convert :records into a list of tuples, and use it instead of
> records. Right?

Or a different data structure that uses basic python types.  I don't
know about the patch that Evan suggested, but I do suggest you convert
the record objects into bare python types before storing them.  It'll
make it easier to explain and maintain.

-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"