[albatross-users] Wiki example and related extension: iterate over ctx/session

Dave Cole djc at object-craft.com.au
Tue Jul 8 23:50:24 EST 2003


> where debug.ht does
> 	Session Vars are:<ul>
> 	<al-for iter="i" expr="session"><li><al-value expr="i.value()"/></li></
> al-for>
> 	</ul>
> 
> This will not show 'new' as a session variable, because it was added
> after the session_vars() call.  Putting (a reference to) the __vars
> dict into the session will not have this problem.
> 
> The other way around the problem is to do the "ctx.locals.session =
> ctx.session_vars()" bit in every page_display() routine just before
> the run_template call, which is ugly and unnecessary boilerplate.

How about this:

   <al-for iter="i" expr="__ctx__.session_vars()">
     <li><al-value expr="i.value()"/></li>
   </al-for>

  http://www.object-craft.com.au/~djc/albatross/mixin-ses-base.html

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list