Dnia piątek, 29 września 2006 09:00, Daniel de la Cuesta napisał: > Hi, I am beginner working with Zope. I like it but I have some doubts: > > I have an structure with folders and subfoulders, each folder and subfolder has items. > > I want to go round this structre with a Python based script, to know the number of elements i do the following: Subject of your post is confusing for me. "Path expressions" is a term from PageTemplates world. Look at path expressions: <span tal:content="request/parameter"></span> or <span tal:content="python:path('options/parameter')"></span>
> path="animals" path is a local variable (for your 'Script (Python)') > items=len(context.sections.path.contentValues()) Here you try to find an object (Folder) called 'path' inside object called 'sections'. > When I try to run the script I get an error saying that the variable "path" is not present. Yup, there is no 'path' object inside 'sections'. > If i do: > > items=len(context.sections.animals.contentValues()) > everything is ok, because there is 'animals' object > How can I refer to a variable into a path expression in a Python Based Script? Try: context.sections[path].contentValues() -- eXt _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )