[Zope] Accessing properties of the folder of a document

complaw@hal-pc.org complaw@hal-pc.org
Thu, 6 Dec 2001 17:00:44 GMT


Hi Andreas:

Assuming that the DTML Method (for example) is called from within the folder in
question, here is some code...

The following code reviews each of the Folder and DTML Document objects within
the 'context' folder (i.e., the one where the particular method is called).

for obj in context.objectValues(['Folder', 'DTML Document']):
  obj.title # this is the object's title property...
#  ... Add some code here to do something with the property...

How to take properties from a folder and get at its contents?  Do this...
Put the Python script in the folder that contains the folders you want to 
review.  Then put a DTML Method that calls the python script.  Here is the code
to put in the python script...

for fold in context.objectValues('Folder'):
  the_folder_title = fold.title
  for docs in fold.objectValues('DTML Document'):
    the_document_title = docs.title

Chapters 4 and 5 of the Zope Book can help you.  You can read the Zope Book
online at http://zdp.zope.org/projects/zbook

There is also ZopeLabs (http://www.zopelabs.com) that has some very handy
recipies for doing common tasks in Zope.

Hope that helps.

Ron
  

> Hello,
> 
> I wonder if I did not read carefully the docs but I have not found a clue,
> how to access the properties like 'id', 'title' and potentially others
> from the folder my DTMLDocument or a self written product (in Python code).
> 
> Any ideas / examples how to do that?
> 
> Kind regards
> 
>         Andreas.
> 
> _______________________________________________
> 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 )
>