[Zope-dev] Sequencing question

David Williams David.Williams@Rubus.com
Mon, 27 May 2002 17:25:50 +0100


Ooops, sorry, sent this by mistake before I had finished .... try again

Hi all
First-time posting from a Zope newbie ... hopefully someone can help 

I have defined a number of ClientProjects within Zope and I am trying to
display these in a number of ways, filtered by object property values.
So, for example, I want to display all client projects, or perhaps only
those marketing projects, ie. where the marketing property has a value.

I display the client project titles in an HTML table, 3 per row, and for all
projects this works OK - I use the sequence-number to control the table
formatting, and the index sequence is unbroken when all objects are
displayed.

My problem arises when I have a sub-set of projects to display, because the
sequence-number and sequence-index values still seem to relate to the full
set of objects. So if the sub-set only comprises objects 7 & 8 (eg the only
marketing projects), the sequence-number is not reset automatically to 1 & 2
- they remain at 7 & 8. The same applies to the property sequence-index. So
the way I check for the 3rd item in the collection, using sequence-number,
does not work becuase the sequence number is not guaranteed to start at 1.

I think I need a Python function to query and return a subset of objects,
but how do I go about writing such an external method ? And how does it
access my Zope ClientProject objects ?

I also looked at using dtml-let and trying to keep a separate count ticking
along, but seem to run into trouble with the variable's scope. 

Or is there an easier way around this that I have missed ?

Any ideas ?

Thanks in advance
Dave