On Mon, Jan 19, 2009 at 6:20 PM, Jonathan Vanasco <[email protected]> wrote: > > i believe AttribSafeContextObj are a convenience method for templates > > its really a PITA to look at and maintain > > % if hasattr( c , 'name '): > > so we have a cleaner > > % if c.name : > > if you'd rather the templates work as python does (and less like > templating languages ) you can use the ContextObjm set strict_c to > true, etc -- but i don't know why you'd want to.
It all depends how you design your templates. I could ask the opposite question: why do you want an attribute that sometimes exists? Why can't the controller set 'c.name = None' to indicate there's no name? Then '% if c.name:' would work as normal. -- Mike Orr <[email protected]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
