[Zope-dev] Replaceable types?

Chris McDonough chrism@zope.com
Sun, 17 Mar 2002 11:22:40 -0500


The current object manager code allows for three kinds of subobjects:

unique -- prevents the creation of an object with the same name as one 
that is in the current object manager or one that is acquired.  This is 
what Steve was talking about.  It's signified by the acquired object 
having a __replaceable__ = Globals.UNIQUE value.

not replaceable -- the default.  if you ask an object manager to store a 
subobject of the same name as one it already contains, and the existing 
object has no __replaceable__ attribute or has a __replaceable__ 
attribute that == Globals.NOT_REPACEABLE, the object manager raises a 
BadRequestError.

replaceable -- if you ask an object manager to store a subobject of the 
same name as one it already contains, and the existing contained 
object's __replaceable__ attribute is set to Globals.REPLACEABLE, the 
call will succeed and the new object will replace the old one.

- C


Chris Withers wrote:
> Ivo van der Wijk wrote:
> 
>>First of all, is allow_dup ever set to true? 
>>
> 
> Probably
> 
> 
>>Does zope support
>>duplicate id's in an ObjectManager anywhere at all?
>>
> 
> Definitely
> 
> 
>>Secondly, can someone give me an example of a Replaceable object?
>>
> 
> If a class defines a PUT_factory method, this may be set as replaceable so that
> someone can override it by dropping a Python Script or External Method called
> 'PUT_Factory' into the ObjectManager.
> 
> This is the case for the CVS version of the Skins tool in CMF...
> 
> cheers,
> 
> Chris
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
> 


-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"