When developing or debugging Albatross applications, one of the things you need to get right is when variables enter and leave the so-called "local context", and what values they have. Debugging this can be tedious, so I wrote a simple macro that I can call from any template that will show the name and value of all the variables currently in the ctx.locals namespace.

<al-macro name="showcontext">
    The current local context is:
      <al-for iter="ctxiter" expr="locals().keys()">
        <li><al-value expr="ctxiter.value()"> = 
            <al-value expr="locals()[ctxiter.value()]">

This could be turned into a custom tag which only outputs data when something in the context or application is set. I wrote a JSP tag that dumped the request and session attributes to the page and it was very useful, especially for watching session usage. -- Matt

None: Displaying_the_Context (last edited 2011-02-15 06:05:17 by localhost)