[Zope-dev] Replaceable types?

Ivo van der Wijk ivo@amaze.nl
Sun, 17 Mar 2002 03:13:34 +0100


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                               -=-