[Zope] RE:Quick Question

Dylan Reinhardt zope at dylanreinhardt.com
Sat Nov 22 19:20:12 EST 2003


On Sat, 2003-11-22 at 15:57, Goldthwaite, Joe wrote:
> Thanks Derek, Paul, and Cameron.  I appreciate the help.  I created the
> EVENT_LOG_FILE environment variable and then took the "s" off "constructors"
> and I did get an error in the log.  It really helps to know where to look
> and I appreciate the time you guys took to respond.
> 
> I'm still running into confusing errors.  I have a form that adds a new user
> that looks like this;
> 
> <dtml-in valid_roles>
> <dtml-if expr="_vars['sequence-item'] != 'Anonymous'">

Here's what you really want:

<dtml-in valid_roles prefix=role>
   <dtml-if "role_item != 'Anonymous'">

The basic problem is that "sequence-item" is not a valid name in
Python... it will be interpreted as "seguence minus item" and those
probably aren't names you've initialized.  

The underscore/bracket syntax is a way of working around this problem,
but a pretty weak one.  You're far better off, IMO, getting in the habit
of using the prefix attribute of <dtml-in>.  It allows you to nest loops
and ensures that all your loop variables are valid Python names.  

HTH,

Dylan




More information about the Zope mailing list