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.

     for=".IYourObject zope.app.container.interfaces.IObjectAddedEvent"

handler pseudo code:

def addCatalogAndIndex(obj, event):
   sm = zapi.getNextSiteManager(obj)
   catalog = Catalog()
   addLocalUtility(sm, 'XY', ICatalog, catalog)
   catalog[name] = Index(name, IAnyInterface)


Johan Carlsson wrote:

Gary Poster wrote:

Hm. A very quick look at the patch concerns me a bit. Am I right that, if you apply the patch, then requests that are currently raising a NotYet for you will instead silently fail, not cataloging what you requested? That seems undesirable to me. I'd prefer the exception.

If I'm on the right track here, then the extentcatalog in the zc.catalog package in the sandbox probably is one of possibly many other better solutions than the patch. It postpones cataloging to the end of the transaction, which I believe will remove the NotYet exceptions *and* successfully catalog your data.

In my case I'm not interested in cataloging anything, there reason is
I'm just adding new fields to a newly created catalog and there
aren't any object to catalog just yet.

I'm guessing Ivo has similare problems because he also are creating
the catalog programmetically.

I'm doing this as a part of a custom add view that defines a
overrided createAndAdd(self, data), I think Ivo does it
in a more CMF like fashion (just after quick glans on his code).

I don't have the faintest idea what NotYet is supposted to be
raise for? Accutally I'm haveing problems finding the code
that does this because the traceback is Zope 3 cryptic and
I don't have a debugger setup either.

(I was hoping not having to care about the innerworks of the catalog,
but that maybe is too much too hope for ;-)


Dominik Huber

Perse Engineering GmbH
Jurastrasse 9a
CH-5406 Baden
Telefon: ++41 56 534 7730

fn:Dominik Huber
email;internet:[EMAIL PROTECTED]
tel;work:++41 56 534 77 30

Zope3-users mailing list

Reply via email to