[Zope] Getting Properties of Objects in Folders Within

J Cameron Cooper zope-l at jcameroncooper.com
Wed May 4 13:53:38 EDT 2005


KJZZ Webmaster wrote:
> Max,
> 
> In response to your post here:
> 
> http://mail.zope.org/pipermail/zope/2005-February/156369.html
> 
> I am having some difficulty getting this to work.
> 
> ###
> # everything works fine from here....
> object = []
> results = []
> subbrain = []
> query = 'somekeyword'
> for brain in context.Catalog(meta_type='Folder',
> bobobase_modification_time={'query':DateTime()-14, 'range':'min'},
> PrincipiaSearchSource=query) :
> # results.append(object)
>     path = brain.getPath()
>     print path
>     print '<item>'
>     print '<title>' + brain.title + '</title>'
>     print '<link> + str(path) + '</link>'
>     print '<description>' + brain.description + '</description>'
> 
> # ... through here
> # however, what I'd like to do is get the path to every ExtFile contained
> in these Folders
> 
>     # this should get you every catalogued object in the folder
>     for subbrain in context.Catalog(path=path):
>         print subbrain.Title
>         print subbrain.Description
>         return printed
> 
>     print '<pubDate>' + str(brain.date) + '</pubDate>'
>     print '</item>'
> 
> return printed
> 
> Any additional help you could offer is appreciated.

So narrow your second catalog search::

     for subbrain in context.Catalog(path=path, meta_type="ExtFile"):

Or something like that. Easy.

FYI, returning some data structure to your page template is recommended 
over directly outputting HTML.

		--jcc

-- 
http://plonebook.packtpub.com/


More information about the Zope mailing list