[Zope] editing zclass instance properties

Jim Washington jwashin@vt.edu
Sun, 25 Feb 2001 23:46:27 -0500


Hi, Oliver

Your code very nearly works. I would say "If it were a Python..." but 
then, well...

Some not-very-different code that will work:

<dtml-with "todo.createInObjectManager(REQUEST['todo_id'],REQUEST)">
<dtml-call 
expr="propertysheets.todo_info.manage_changeProperties({'todo_title':'Do 
that'})">
</dtml-with>

If you are altering something on a particular propertysheet, you need to 
tell the propertysheet that you are changing it.

You can look at the source for the difference between 
manage_changeProperties() and manage_editProperties().  I could not see 
much difference, except that manage_editProperties() seems to require 
all of the values to be in REQUEST, and manage_changeProperties() can 
additionally take dictionaries or keyword values for parameters.  I 
think sticking with manage_changeProperties() is your best bet.

-- Jim Washington

Olivier Laurent wrote:

> Hello,
> 
> I've created a zclass to manage a list of tasks to be done with some 
> properties called todo_title, todo_priority, todo_expiry,...
> The propertysheet is called 'todo_info', the product 'ToDoProduct' and 
> the zclass 'todo'
> 
> Each instance is created in a folder called 'todos' with names like 
> 'a982706331', 'a456812195',...
> 
> I put the instance id in a variable called 'todo_id'
> 
> I'm trying to change zclass instance properties. I followed the Zope 
> Developer's Guide :
> <dtml-call "a982706331.manage_changeProperties({'todo_title':'Do 
> this'})">
> but nothing changes (no error messages).
> I tried a lot of different things like :
> 
> <dtml-with "todo.createInObjectManager(REQUEST['todo_id'],REQUEST)">
> <dtml-call 
> expr="propertysheets.todo_info.manage_editProperties({'todo_title':'Do 
> that'})">
> </dtml-with>
> 
> or
> 
> <dtml-with todo_id>
> <dtml-call "manage_editProperties({'todo_title':'Do this'})">
> </dtml-with>
> 
> or
> 
> <dtml-with todo_id>
> <dtml-call "manage_changeProperties({'todo_title':'Do that'})">
> </dtml-with>
> 
> Could someone help me fix the problem ?
> 
> Also : what's the difference between 'manage_editProperties' and 
> 'manage_changeProperties' ?