[Zope-dev] getitem in python script

Leonardo Rochael Almeida leo@hiper.com.br
14 May 2002 14:03:05 -0300


First some politics:

1. please,don't send html e-mail
2. this question is better suited to zope@zope.org

Now for your answer:

getitem isn't a normal zope method. It's an _ method, but the _ object
is not usually what you want to use in a PythonScript.

you either want:

getattr(container, 'folder')

or

container.restrictedTraverse('folder')

restrictedTraverse takes a slash separated path (or a tuple of strings)
representing a relative or absolute path (an absolute path starts with a
slash)

Cheers,

On Tue, 2002-05-14 at 12:18, Eddie Moench wrote:
> is there a possibility to use the getitem method in python scripts?
>  
> My concrete problem is as follows:
> I have a parameter - say folder - as input and just want to jump into
> that folder:
> the script:
>  
> return container.getitem('folder').id
>  
> does not work! Has anyone a solution?
>  
> Thanks, Eddie.
-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.