I definitely agree that strict_undefined should be encouraged, and I have been refactoring to achieve that in my own stuff. My emphasis was just on avoiding a 'gotcha' for some.
On Jun 12, 12:43 pm, Mike Orr <[email protected]> wrote: > On Sun, Jun 12, 2011 at 8:08 AM, Eric Ongerth <[email protected]> wrote: > > @Sluggo et al.: > > Hi Mike, > > > It's my own responsibility for not noticing the difference in > > settings, but I stumbled around for a while last night trying to > > figure out why I was getting NameErrors in templates that used to have > > none. I should have immediately thought of the config setting > > "mako.strict_undefined" but it didn't occur to me because I had set my > > app aside for a while between pylons and pyramid and only recently > > picked it back up. > > > The only reason I'm posting is I wanted to point out that Pyramid > > defaults to False on this: > >http://docs.pylonsproject.org/projects/pyramid/1.0/narr/environment.h... > > > While Akhet defaults to True: > >http://sluggo.scrapping.cc/python/Akhet/architecture.html#development... > > > And it's enough of a 'gotcha' that I think some newcomers (or people > > like me who keep converting themselves back into newcomers by going > > away to work on other stuff and coming back again) could repeat the > > same experience if they were not scrutinizing the docs line-by-line. > > My own fault that I didn't, but the essence of my point is that even > > if I had read the docs more closely I might still not have caught the > > fact that merely by choosing Akhet my templates would behave > > differently in an important way. (In case that doesn't make sense, > > some of my templates used to depend on strict_undefined=false for > > control flow -- specifically, in the trick I was using to allow the > > same template to be reused as both the 'create' form and the 'update' > > form for the same class in my CRUD app.) > > > So maybe it's worth a paragraph with or without its own heading in the > > Akhet docs. > > I'll put a note in the Templates section. It shows it in the INI file > but doesn't elaborate on it. It defaults to strict because that's what > Pylons does, and because I thought most people agreed that not > defining all your variables was bad program design. I usually do > something like 'is_new = True' or 'record_id = None' to indicate a > create view as opposed to an edit view. > > -- > 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.
