[Zope] Setting a ZObject's title in its constructor

Dieter Maurer dieter@handshake.de
Mon, 17 Feb 2003 00:05:43 +0100


Rob Thorne wrote at 2003-2-14 17:49 -0800:
 > Using 2.6.1, I'm trying to get the constructor of a ZClass to 
 > dynamically assign the ID, and set the title from data passed to the 
 > constructor.   Setting the ID works fine; setting the title isn't 
 > working at all.
 > 
 >  From the constructor:
 > 
 >     *# Create an ID dynamically
 >     timestamp = "SHLH-%X" % int(context.ZopeTime())
 >     request.set('id', timestamp)
 > 
 >     request.set('title', 'My title')
 >     #request.set('title', request.form['Sender_Name'])
 > 
 >     instance = container.MyZClass.createInObjectManager(request['id'],
 >     request)
 >     *
 > 
 > Why does this work for 'id', but not for 'title'?  Older code samples 
 > using dtml seem to have set both attributes the same way.

Because "createInObjectManager" sets the id but not the title.

Use "manage_changeProperties" to change the title.


Dieter