[Zope-dev] Soft links again

Andre Schubert andre.schubert@geyer.kabeljournal.de
Wed, 27 Sep 2000 11:34:18 +0200


Hi,

i have read the two messages about Soft Link, and i tried to work with it,
because it it very important for my Product.
The problem is that the Soft Link class won't work and i don't know why.
I use zope 2.2.2 and python 1.5.2.
root:
    -myproductfolder
        -SoftLink to testdtmldoc
    -testfolder
        -testdtmldoc

In myproduct i have the following function, the class SoftLink is the same
as of Shane Hathaway.
I wan't to add a SoftLink in myproductfolder which links to testdtmldoc.
When i call the function manage_addSoftLink nothing happens??

def manage_addSoftLink(self, REQUEST=None):
        .....
        obj=SoftLink('Test/link')
        self._setObject('TestSoftLink',obj)

Whats going wrong, or did i missunderstand something?
Who can help?

as

Shane Hathaway schrieb:

> [cut]
> 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):
>       try:
>         ob = self.restrictedTraverse(self.path)
>       except:
>         # We're not in context or the object was not found.  Default to
> self.
>         return self
>       else:
>         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)
>
> Shane
>
> _______________________________________________
> 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 )