[Zope-CMF] Plone:strange behaviour of my own portal type

Florent Guillaume fg@nuxeo.com
Sun, 26 Jan 2003 19:11:43 +0100


In article <200301210509.31728.robert@redcor.ch> you write:
> Now my problem.
> When all data has been provided trough a "standard" edit screen I want to=
>  
> rename the object so it reflects first and last name of the user it 
> describes.
> This I do in the object_edit.py script that is called after the edit sess=
> ion.
> What i to is I just assign a new value to the id.
> As a result I have an instance of my portal type with the new id.
> 
> Now my real problem:
> externaly the object has a new id. That is in the ZMI (and in folder cont=
> ents) 
> it shows the new Id.
> Internaly however, that is when I call object.getId() I still get the old=
>  id.
> 
> What could be the reason. Do I have to call a method on the object to set=
>  the 
> new id ??

In Zope 2 both the object and its container have to know an object's id.
So the only correct way to rename something is to call
        thecontainer.manage_renameObject(oldid, newid)

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com