Hi, I'm still fighting with making my QuotaFolder work with some (imho) buggy code in Zope (mainly caused by exceptiontype-less try: except: constructs) (of course, I could patch the problems in Zope, but I'd still like my product to work without patches) The ObjectManager seems to have support for 'replaceable objects', i.e. when looking at checkValidId: if not allow_dup: obj = getattr(self, id, None) if obj is not None: # An object by the given id exists either in this # ObjectManager or in the acquisition path. flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) if hasattr(aq_base(self), id): # The object is located in this ObjectManager. if not flags & REPLACEABLE: raise BadRequestException, ('The id "%s" is invalid--' 'it is already in use.' % id) First of all, is allow_dup ever set to true? Does zope support duplicate id's in an ObjectManager anywhere at all? Secondly, can someone give me an example of a Replaceable object? Thanks, Ivo -- Drs. I.R. van der Wijk -=- Brouwersgracht 132 Amaze Internet Services V.O.F. 1013 HA Amsterdam, NL -=- Tel: +31-20-4688336 Linux/Web/Zope/SQL/MMBase Fax: +31-20-4688337 Network Solutions Web: http://www.amaze.nl/ Consultancy Email: ivo@amaze.nl -=-
Ivo van der Wijk wrote:
Secondly, can someone give me an example of a Replaceable object?
Any object that doesn't represent a service-kind-of-thing. The term "replaceable" is used in the context of acquisition. Making things non-replaceable is a way of providing a particular service (say, a MailHost), and ensuring that this service will not be inadvertantly shadowed by something else (a DMTL Method perhaps) in a higher-up folder. The concept of "replaceable" isn't needed in Zope 3, as services are kept separate from content. -- Steve Alexander
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
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"
participants (4)
-
Chris McDonough -
Chris Withers -
Ivo van der Wijk -
Steve Alexander