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

Dominik Huber dominik.huber at perse.ch
Thu Nov 17 10:49:38 EST 2005


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)

Regards,
Dominik



                   

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 ;-)
>
> Johan
>
>
>
>
>


-- 
Dominik Huber

Perse Engineering GmbH
Jurastrasse 9a
CH-5406 Baden
              
E-Mail: dominik.huber at perse.ch
Telefon: ++41 56 534 7730

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dominik.huber.vcf
Type: text/x-vcard
Size: 154 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20051117/6b6c340d/dominik.huber.vcf


More information about the Zope3-users mailing list