[Zope] CoreSessionTracking - looping over items
Pawel Lewicki
lewicki@provider.pl
Mon, 23 Jul 2001 21:42:29 +0100
----- Original Message -----
From: "Chris McDonough" <chrism@digicool.com>
To: "Pawel Lewicki" <lewicki@provider.pl>
Cc: <zope@zope.org>
Sent: Monday, July 23, 2001 7:14 PM
Subject: Re: [Zope] CoreSessionTracking - looping over items
> Please try to keep correspondence on the list.
>
> THis can't be done from DTML if you're using an internal session data
> container because DTML can't access attributes with a leading underscore.
> Either use an external session data container or use an external method.
> For instance, here's an external method that returns the number of session
> data objects in the internal session data container, along with some DTML
> that calls it.
>
> def numberOfDataObjects(session_data_manager):
> return len(session_data_manager._sdc)
>
> <dtml-var "numberOfDataObjects(session_data_manager)">
I tried with python script but at zope says "Names starting with "_" are not
allowed ", so I suppose it should be method defined in the external file. Is
it enough to put .py file in Extensions directory with this piece of code?
I've never tried external methods. The idea comes from ZopeBook and
description of defining Brains to Z SQL Methods. It is the only reference I
have on mind at the moment.
As it doesn't work it should be something different. What should I do to
make numberOfDataObjects visible to dtml document? And with the same
solution is it possible to return the whole _sdc attribute as sliceable
object to iterate with <dtml-in>?
Pawel Lewicki