Am Mittwoch, 13. April 2005 12:19 schrieb Pierre-Yves Delens:
> Bonjour,

Guten Tag,

> I'm developing my first ZODB app (without Zope).
> I need to display sorted items from a BTree.
> Sorting should happen by one of the fields value, not by key order.

You can use "decorate sort undecorate". There are some examples in 
the python cookbook. 

> - Is IndexedCatalog the good solution ?

You don't need indexedCatalog for sorting. If your
whole btree fits into memory you can use it like a python 
dictionary.

I looked at IndexedCatalog, but diceded to use may own 
Catalog which implements a small subset of the Index-API
of Zope2. IndexedCatalog is more implicit than explicit.

If I could do a rewrite of my app, I would have a look at
the indexes of Zope3.

Building simple indexes with btrees is not dificult:
Just map the value of your object to the ID of your object:
   catalog.name["Pierre"]=.... # Every object has an integer ID in my app.
Be sure to write unittests, which check that the (redundant) data of
the catalog don't get out of sync.

 HTH,
   Thomas

-- 
Thomas Güttler, TBZ-PARIV GmbH, Bernsdorfer Str. 210-212, 09126 Chemnitz
Tel.: 0371/5221217 Fax:  0371/5221216

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to