[Zope] Viewing objects in sub-folders

sean.upton@uniontrib.com sean.upton@uniontrib.com
Fri, 14 Dec 2001 09:49:12 -0800


Zope's 'ObjectManager' API has a very simple format for accessing
subobjects, which genearally can use Python's means of accessing an
attribute by name:

#in python:
subfolder = myfolder['subobjectid']

#dtml:
<dtml-with "subobjectname">
  We are now in the namespace of the object with an id of subobjectid.
</dtml-with>

It sounds like you want to use recursion; look in the Zope help system for
the ObjectManager in API reference.  This will be useful to you.  You may
want to use methods like objectIds() or objectValues(), which you can loop
over in DTML or in Python.  You can pass the meta type of your objects to
these methods to restrict what object ids/values you retrieve.  Other
methods can be used from your objects themselves using the
ObjectManagerItems interface, like restrictedTraverse() and
getPhysicalPath().  Folders participate in both these interfaces, via the
various mixin Classes that they inherit from.

Aside from the API help, you may find lots of useful things on recursively
walking a tree of objects on sites like www.zopelabs.com.

Good luck,
Sean

-----Original Message-----
From: Stephen Schneider [mailto:stephen@mindarch.com]
Sent: Friday, December 14, 2001 7:27 AM
To: zope@zope.org
Subject: [Zope] Viewing objects in sub-folders


Hi all,

I am new to Zope.  I have been working with it for my company and getting a
web site together.  So far I'm liking it more than I thought.

I have started getting into using dtml and have hit a wall.  Let me
describe.

I have a folder that has 3 sub folders.  I created 3 zclasses/products.
Users add new objects into these 3 folders, the objects being one of the 3
products created.  Now I have a dtml method that will list the objects in
the folder with the properties that were set.  I can go to any of the 3
folders and view the dtml method to see the objects there.  But what I need
is this.  I have an index_html in the main folder containing these 3
folders.  This index_html needs to use the dtml method for displaying from
each folder.  So on the index_html the objects and properties from all 3 sub
folders would be displayed in a columnar format.  What do I use/do on the
index_html to use or display the objects in a sub-folder?

Make sense?  I hope so.  I would appreciate any help or guidance to get
going on this.

Stephen


___________________
Stephen Schneider
Mind Architecture
"It's an Internet Thing..."
www.mindarch.com
stephen@mindarch.com
(330) 329 - 8748
(617) 507 - 0504 fax
AOL IM - mindarch



_______________________________________________
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 )