[Zope3-dev] Should containers tell you if they accept empty string keys?

Jim Fulton jim@zope.com
Mon, 18 Nov 2002 16:47:05 -0500


Florent Guillaume wrote:
> Guido van Rossum  <guido@python.org> wrote:
> 
>>>>In particular, if you pass the returned key to another call to
>>>>setObject(), will it overwrite the object whose setObject() call
>>>>returned that key, or will it generate a new key again???
>>>>
>>>If the container doesn't ignore the key, it will generate a
>>>DuplicationError.
>>>
>>Ah, so setObject() can't be used to overwrite an existing object.
>>That simplifies things.
>>
> 
> Note that Zope 2 objects have the option to declare
>     __replaceable__ = Globals.REPLACEABLE
> to allow themselves to be overwritten by another object with the same id.
> 
> However I don't know what it's used for in Zope 2,

It provides a way to overide the rule that you can't override a
class-defined attribute (like a method). That rule is there because items
and attributes are in the same namespace in Zope 2.

It's an awful situation that we've avoided in Zope 3 by being explicit
about URL namespaces (at the cost of unusual urls like afolder/@@contents.html).


 > and if it's a planned
> feature for Zope 3.

Nope.

Jim


-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org