[Zope-dev] Multi-homed objects?

Shane Hathaway shane@digicool.com
Mon, 17 Jul 2000 09:00:34 -0400


Chris Withers wrote:
> 
> Oleg Broytmann wrote:
> >    Hardlinks are prohibited on directories; and 5 minutes ago you said all
> > objects are foldersih :)
> 
> I'm not sure if my statement applies in this situation... ;-)
> 
> >    Hardlinks are prohibited on directories because it'd cause infinite
> > loops on traversing.
> 
> Hmm, would Python catch those already?
> 
> Obviously care would need to be taken and it might be possible to build
> a loop checker into whatever creates the hard links...

This could be part of a "visitor" interface I've been pondering in the
back of my mind.  It would be capable of traversing, performing an
arbitrary function, and never falling into a recursive trap.

class ObjectManager:

  ...

  def visit(self, func, visited=()):
    func(self)
    for id in self.objectIds():
      ob = self._getOb(id)
      if hasattr(ob, 'visit') and ob not in visited:
        ob.visit(func, (ob,) + visited)

Shane