[Zope-CMF] Listing published items in CMF folder

Frank Bennett bennett@nomolog.nagoya-u.ac.jp
Sat, 18 May 2002 18:54:14 +0900


In CMF 1.2, Zope 2.4.

For a newsletter, I have used CMF's built-in news facility to generate and
provide editorial workflow for the content.

I want to provide two views of the newsletter: one of recently posted items,
and another of past issues.  The first is easy, of course.  The second is the
subject of this query.

The final versions of the articles go into a single hierarchy, and I have set
up a couple of page templates that parse the hierarchy and metadata to produce
a list of issues and tables of contents for each.

The table of contents is modelled on the recent_news.pt template. I subbed in
a call on listFolderContents for the searchResults used in the original, and
it works -- but demands a password if any item in the target folder is not in
'published' review state.

I want such items to fail silently instead.  I have tried two approaches (with
much blind fumbling about).  The first sought to get the objects themselves
and examine them to see if they were in published review state.  This failed
because manager was denied permission to load "getReviewStateOf" from
DefaultWorkflow.py in a simple script.

The second approach involved using searchResults with a path parameter to
limit the scope of the search.  searchResults(path='<x>') (where <x> was set
to various trial values) seems to show promise, but so far, it only delivers
one of everything-on-the-system or nothing.

I know that the cleaner solution will be to stamp each article with metadata
indicating the issue in which it was published, and having wasted a good deal
of time trying to do it the wrong way, I have seen the light.  But this
problem has gotten under my skin today, and I am curious what the solution is.

Frank Bennett
Nagoya University
Japan