[Zope3-Users] Anyone had any success with ZCatalog in Zope 3?

Johan Carlsson johanc at easypublisher.com
Thu Nov 17 10:54:06 EST 2005


Dominik Huber wrote:
> Hi Johan
> Your problem is that the catalog is not locatable itself during the 
> addition of its indexes (-> state within the create and add method), 
> therefore the location of the indexes cannot be located and the 
> NotYetError is raised. You can move your code to an 
> ObjectAddedEvent-subscriber for your object.
> 
>  <subscriber
>      for=".IYourObject zope.app.container.interfaces.IObjectAddedEvent"
>      handler=".addCatalogAndIndex"
>      />
> 
> handler pseudo code:
> 
> def addCatalogAndIndex(obj, event):
>    sm = zapi.getNextSiteManager(obj)
>    catalog = Catalog()
>    addLocalUtility(sm, 'XY', ICatalog, catalog)
>    catalog[name] = Index(name, IAnyInterface)

Ok, that's by the way how Ivo does it (I've just read).

Thanks,
Johan


-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM


More information about the Zope3-users mailing list