"Ibaņez Palomar Juan David" wrote:
> Hi all,
> First, I'm using Zope 2.2.1 (Debian package).
> I've been trying to implement zope objects that behave like unix soft
> links. The message
>   http://lists.zope.org/pipermail/zope-dev/2000-July/005963.html
> by Shane proposes an implementation based in the __of__ method:
> (snip)
> but it fails when I try to create an instance.

Try this.  I failed to account for the fact that sometimes the object is
not in context and therefore the linked object will not be found.

   def __of__(self, parent):
        ob = self.restrictedTraverse(self.path)
        # We're not in context or the object was not found.  Default to
        return self
        return getattr(ob, 'aq_base', ob).__of__(parent)

Keep in mind, though, that there are all kinds of security
implications.  Someone will have to think hard about security before
this is viable.

OTOH perhaps it's really simple.  Try this as the last line instead:

        return getattr(ob, 'aq_inner', ob).__of__(parent)

This way, the security context might be retained.  If it doesn't work,
try changing the last line to:

        return ob.__of__(parent)


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to