[ZPT] Using ZPT Varibles

Will Smith witisi at yahoo.com
Thu Jul 8 11:25:52 EDT 2004


I am currently using ZPT with CMFFormController.  I am able to get the 
form controller to return its error information and put it into a 
dictionary.

tal:define="errors options/state/getErrors"

At this point I can print errors if they exist

errors/name_of_error
or
python:errors['name_of_error']

The question is i have a variable that has 'name_of_error' that may or 
may not be a key in the errors dictinary.

I have tried:
tal:define="field_name string:user_name;
             error python:test(errors[field_name].has_key(), 
errors[field_name], None)"

-- but only works if field name is a valid key.  I guess I am looking 
for some sort of try:.  I guess I am looking for something like the 
context.REQUEST.get('name', None) but on a standard dictionary. 
"tal:conditions" seem to be really ugly way to do this.

Hope this is clear, I provide more details upon request.

Thanks,
Will Smith



More information about the ZPT mailing list