[Zope] Drilling into second-level object properties

Jaroslav Lukesh lukesh at seznam.cz
Mon Aug 18 12:28:18 EDT 2003


> Odesílatel: Dan Shafer <dan at shafermedia.com>
> I have a Zope application. When using it, people we call facilitators 
> create a new folder for a particular client interaction. Then as they 
> progress through the structured interaction, each phase creates a new 
> document whose only contents are a call to a DTML method that displays 
> objects' contents. Each of these documents has a set of properties 
> associated with it.
> 
> So the structure is:
> 
> Folder
>    Document (with properties)
>      <dtml method call>
> 
> Now, I need to write a routine that iterates over all the folders in a 
> given directory, examines the document called [caseID]info to determine 
> if one of its properties (coach_id) matches the name of the currently 
> AUTHENTICATED_USER. If so, display the folder as an HREF (that I have 
> working fine) and if not, skip it.

Hi,

you need to use recursive calling. Please inspire yourself with this DTML
Method called "x_ST"" that deletes all images in folders "s" or "t"
recursively if they present:

<dtml-in "objectValues([    'Image',
                            'Folder',
                            'ZipFolder' ])" skip_unauthorized>
  <dtml-if "_['sequence-item'] in ('s', 't', 'xs', 'xt')">
      <dtml-let container=this>
        <dtml-in "objectValues(['Image'])">
          DEL: <dtml-var absolute_url>
          <dtml-call "container.manage_delObjects([getId()])">
        </dtml-in>
      </dtml-let>
  </dtml-if>
  <dtml-if "(meta_type=='Folder') or (meta_type=='ZipFolder')"
    ><dtml-with sequence-item
      ><dtml-var x_ST
    ></dtml-with
  ><dtml-else
  ></dtml-if
></dtml-in>

Regards JL.



More information about the Zope mailing list