[Zope] a form, a script and the namespace: please help a newbie !

Giuseppe Bonelli g.bonelli@pn.itnet.it
Sun, 26 Aug 2001 02:24:30 +0200


I _really_ need help on understanding why this does not work.

What I'm trying to do:
I want to change, from a python script called from a dtlm method, a =
class instance property value.

The code I use:
let 'description' be a property of the class instance foo;=20
initially, suppose foo_instance.description=3D'bar'=20

DTML method fooEdit
[...]
<dtml-call normalize_default_values>
   <form ...>
     <textarea name=3D"description"><dtml-var description></textarea>
   <input type=3D"submit" ...>

Python script normalize_defaul_values
[...]
description=3Dcontext.description
if description=3D=3D'bar': description=3D''
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.

Notes:
If I insert a <dtml-var "REQUEST"> inside the foo.edit DTML method, the =
'description' property is shown as having value '', as expected.
I have also tried to add to the script "return =
context.manage_changeProperties({REQUEST['description']:description})", =
but the result is the same.
If I use a new property name, for example new_description, everything =
works as expected.

Questions:
How can I change the _existing_ foo_instance.description property from a =
python script ?
Obviously I am missing something important about namespaces: someone =
can, _please_, point me in the right direction ?


TIA,

--peppo