[Zope] way the acquired a path

Dirk Datzert Dirk.Datzert@rasselstein-hoesch.de
Fri, 28 Dec 2001 21:21:03 +0100


Thanks to all,

that was I was looking for.

Regards,
Dirk


Sidnei da Silva schrieb:

> You can call the restrictedTraverse method on your object. It accepts both
> forms of path you mentioned.
> '/test/abc/defg' or ['test','abc','defg']
>
> So:
>
> def t(self, path):
>   return self.restrictedTraverse(path)
>
> should do what you need without any problem.
>
> Em Friday 28 December 2001 15:47, Peter Bengtsson escreveu:
> > splitted = '/folder/subfolder/obj'.split('/')
> > object = context # or 'self' if this is an external method
> > for id in splitted:
> >     object = getattr(object, id)
> >
> > return object # should return the 'obj' object
>
> --
> Sidnei da Silva
> X3ng Consultoria e Desenvolvimento Ltda.
> sidnei@x3ng.com.br
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )