Giuseppe Bonelli writes:
... DTML method fooEdit [...] <dtml-call normalize_default_values> <form ...> <textarea name="description"><dtml-var description></textarea> <input type="submit" ...>
Python script normalize_defaul_values [...] description=context.description if description=='bar': description='' return context.REQUEST.set('description',description)
What happens with this code: when I view foo_instance/foo_Edit, 'description' is always 'bar', not '' as I'd expect. The reason:
"REQUEST" is far down the DTML namespace, lower than the object itself. Therefore your "<dtml-var description>" find the (unchanged) "description" attribute value of "context" and not the new one set in "REQUEST". The work around: <dtml-with REQUEST> .... <dtml-var description> .... </dtml-with> This pushed "REQUEST" on top of the DTML namespace such that its definitions are examined before that of "context". Dieter