[Zope] emulate a sequence
Jonathan
dev101 at magma.ca
Thu Feb 8 09:18:16 EST 2007
----- Original Message -----
From: "Yuri" <yurj at alfa.it>
To: <zope at zope.org>
Sent: Thursday, February 08, 2007 9:09 AM
Subject: [Zope] emulate a sequence
>
> I need a field in zope object which act as a sequence. I mean every time I
> create an object, the value is the previous sequence value of the last
> object created + 1.
>
> also I need to browse the objects by sequence (from the object 1 to the
> last, by the sequence number)
>
> I think I need a catalog FieldIndex to store the sequence for searches, a
> property in the object.
>
> Can I use the catalog to retrieve the max value of the index, so when I
> create the object, I just add 1 and store it in the property?
You could use a catalog if you have other searching requirements, but the
method objectIds() (see the zopebook for more info) will return a list of
contained Ids, which you can then sort to get you what you need. Also,
len(somefolder.objectIds()) will give you the next available id (assuming
your object ids have some sequential numbering).
hth
Jonathan
More information about the Zope
mailing list