Goldthwaite, Joe wrote:
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'">
Zope is giving me this; Error Type: SyntaxError Error Value:Line 2:"_vars" is an invalid variable name because it starts with "_"
The lines are coming out of The Zope Book. I went over the file twice to see if I had mistyped something but I don't see anything. Is the book wrong? There's nothing in my class called _vars so I assume this is supposed to be internal to Zope. Does anyone know what I might be doing wrong?
I don't deal much with DTML so I may be a little rusty, but probably it meant:: <dtml-in valid_roles> <dtml-if expr="_['sequence-item'] != 'Anonymous'"> The underscore is the namespace variable. So this syntax looks up the value with key 'sequence-item' in the namespace.
I'm not very good at typing things in so I've ended up with a lot of typos. I can find and fix them pretty easily but I've noticed that my changes don't get loaded into zope automatically. I restart zope but the original syntax error stays unless I delete the product before I restart. Is there an easier way to force the product to reload?
If you're working on a Product, a restart should re-parse all the code. I've never seen it work any other way. You should also look at the Product refresh functionality. Put a 'refresh.txt' in your product directory and when you visit the Product in the control panel, you can refresh it under the 'Refresh' tab. No restart required: it's great. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."