[albatross-users] Wiki example and related extension: iterate over ctx/session
Dave Cole
djc at object-craft.com.au
Mon Jul 7 20:20:00 EST 2003
> > Is it possible to do the same for the session variables?
> Not in standard Albatross. The list of names in the session is
> stored in a dict called ctx.__vars and that's not available to
> templates. Can't get access to it from the python code due to funky
> '__<>' handling, too. Need to fix this in the SessionBase class.
>
> Perhaps the SessionBase ctor could do:
> self.locals.__session__ = self.__vars
> so your templates could do
> <ul><al-for iter="k" expr="__session__.keys()">
> <li><al-value expr="k.value()"/></li>
> </al-for></ul>
It might have slipped through the documentation updates (*ahem*) but I
did remember to put it here
http://www.object-craft.com.au/projects/albatross/albatross/rel-1.10-ctx.html
This means that you could do something very kludgey like this:
<ul><al-for iter="k" expr="__ctx__._SessionBase__vars.keys()">
<li><al-value expr="k.value()"/></li>
</al-for></ul>
- Dave
--
http://www.object-craft.com.au
More information about the Albatross-users
mailing list