[Zope-CMF] Bug with CMFUid content when copied indirectly and some confusion.

Tim Hoffman timh at zute.net
Wed Aug 25 02:33:21 EDT 2004


Hi 

I am exploring/testing the CMFUid functionality of the new CMF 1.5.0 Beta,
(I have been using my own Uid tool for some time, but it 
relied on the use of a monkey patch which added a mixin class to 
all PortalContent and PortalFolder plus a few others to ensure that all
CMFContent automgically got unique ids and  managment and control of the
uid generation (especially after copying ;-) could be enforced.
 
This approach is a support nightmare however, so I have always been
looking for a more supportable  mechanism hence the investigation of
CMFUid.)

Anyway I am trying to fathom exactly how CMFUid works and have a couple
of questions. (plus I have noticed what I believe to be a bug)

As I understand it, a call to uidtool.register(object) is in main
template. This gets called and if the object doesn't have a uid a new uid
(UniqueIdAnnotion instance) is created and stored as an attribute 
if the content object (currently named cmf_uid).  (UniqueIdAnnotation has
manage_afterAdd and manage_afterClone methods etc).  So far so good.

However I don't understand how the manage_afterAdd/Clone methods get
called.

A normal content object has manage_afterClone/Add by virtue of
ultimately subclassing things like ObjectManager/CatalogAware (CopySupport
Mixin) etc.

But all of these methods iterate  over result of objectValues() calling
manage_afterClone,manage_afterAdd on each as appropriate. 

But becuase the UniqueIdAnnotation is stored as an attribute calling
contentValues on a content object that has a uid doesn't return
the UniqueIdAnnotation object (it isn't based on
SimpleContent/ObjectManager but Persistent and Implicit). 

SO I am a bit confused how when one copies a content object how the
uid is being updated. As I can't find anything that might call
object.cmf_uid.manage_afterClone/Add and cmf_uid will never be
returned from a call to objectValues(). Am I missing something here?


Now I come to the bug I think I have encountered. 
If you copy a folder with content, the contained contents UID's 
do not get updated ending up with duplicate UID's. Which I believe is a
bug. If you copy the content directly the uid does get updated.

I have spent ages playing with manage_afterClone in the past
with my own UniqueId implementation so am reasonably familiar
with the mechanism, but can't for the life of me work out
how it is supposed to work in CMFUid.

Any pointers would be welcome.

Rgds

Tim



More information about the Zope-CMF mailing list