Differences between revisions 2 and 3
Revision 2 as of 2003-07-03 12:29:20
Size: 958
Editor: Matt Goodall
Comment:
Revision 3 as of 2011-02-15 06:05:17
Size: 958
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

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:
    <ul>
      <al-for iter="ctxiter" expr="locals().keys()">
        <li><al-value expr="ctxiter.value()"> = 
            <al-value expr="locals()[ctxiter.value()]">
            </li>
      </al-for>
    </ul>
  </al-macro>


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)