[Zope] way the acquired a path

Sidnei da Silva sidnei@x3ng.com.br
Fri, 28 Dec 2001 16:24:05 -0200


You can call the restrictedTraverse method on your object. It accepts bot=
h=20
forms of path you mentioned.=20
'/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 =3D '/folder/subfolder/obj'.split('/')
> object =3D context # or 'self' if this is an external method
> for id in splitted:
> =A0 =A0 object =3D getattr(object, id)
>
> return object # should return the 'obj' object

--=20
Sidnei da Silva
X3ng Consultoria e Desenvolvimento Ltda.
sidnei@x3ng.com.br