[Grok-dev] zope catalog won't index persistent object in localutility.
zgwmike at gmail.com
zgwmike at gmail.com
Thu Nov 25 08:54:24 EST 2010
hi, all
I have tried the following ways, only one of them works.
1. notify objectcreatedevent, whether or not I commit transaction before
fire this event. it does not work. objects are not indexed.
2. commit the transaction, and index the object manually, like the
following, worked !!
def _addCronJob(self,job):
self.jobs[self.id]=job
job.id=self.id
self.id=self.id+1
self._scheduledQueue.put(job)
#TODO: why we need to index it manually?
import transaction
transaction.commit()
catalog=getUtility(ICatalog)
intids=getUtility(IIntIds)
catalog.index_doc(intids.register(job),job)
Regards
Shrek
--------------------------------------------------
From: "Souheil CHELFOUH" <trollfot at gmail.com>
Sent: Thursday, November 25, 2010 7:22 PM
To: "Sebastian Ware" <sebastian at urbantalk.se>
Cc: "Shrek Zhou" <zgwmike at gmail.com>; <grok-dev at zope.org>
Subject: Re: [Grok-dev] zope catalog won't index persistent object in
localutility.
> I gave Shrek some answers on #grok
> maybe, when he has time, he can summarize what he did to make it work
> in the end.
>
> 2010/11/25 Sebastian Ware <sebastian at urbantalk.se>:
>> I don't know the answer to this particular question, but I am guessing
>> objects in your BTree are not automatically added to the catalog. I have
>> had similar problems when working with annotations.
>>
>> Perhaps you could use a grok.Container instead of the BTree. Or if that
>> doesn't work, add the objects to the catalog explicitly. Here are some
>> hints on how to find and manipulate the catalog:
>>
>> http://grok.zope.org/documentation/how-to/implementing-search
>>
>> Mvh Sebastian
>>
>> 25 nov 2010 kl. 08.03 skrev Shrek Zhou:
>>
>>> Hi,
>>> I have a local utility register under grok.Application, and it owns a
>>> BTree object which contains my objects. and those objects don't get
>>> indexed. Sure i have defined the indexes. What's wrong??
>>>
>>> Regards
>>> Shrek
>>> _______________________________________________
>>> Grok-dev mailing list
>>> Grok-dev at zope.org
>>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>
More information about the Grok-dev
mailing list