Re: [Zope3-Users] problems with catalog: indexing field from an objects adapter

2007-06-06 Thread Bernd Dorn


On 28.03.2007, at 13:19, Dominique Lederer wrote:


hi,

I want to index a field from an object, which works perfectly via  
Catalog and

Field Index.

But if my callable field returns a value, which is returned from an  
adapter of

the object, things get complicated for me:

i create my object an add it to a container (not via zmi).
i do the notify(ObjectCreatedEvent(container[myobjectname]) thing,  
to let the

intid and catalog do their indexing stuff.


i am not sure, but try to fire the objectcreatedevent directly after  
creating the  object
and then add it to the container, this causes the indexing with  
objectaddedevent which is fired by the container



i look at the Catalog statistics in the zmi, where is see, that one  
item is indexed.

but when i delete the object (i used
notifiy(ObjectRemovedEvent(container[myobjectname])), there is  
still something
residing in the index, which causes a KeyError in the intid  
utility, when it

trys to getObject.


object removedevent is fired by the container, you dont have to fire it




It seems, that the index is indexing the object and the adapter via  
the same
unique intid, and then deletes only the objects index, and not the  
adapter?


since my adapter is only accessing annotations on the object, i  
could feed the
index directly via the annotation value, but that goes against the  
use of

adapters and the idea, not to change the object implementation.

Do you have any idea, what i have to do?
Did i forget an event? or something else?

thanks
cheers Dominique
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] problems with catalog: indexing field from an objects adapter

2007-03-28 Thread Dominique Lederer
hi,

I want to index a field from an object, which works perfectly via Catalog and
Field Index.

But if my callable field returns a value, which is returned from an adapter of
the object, things get complicated for me:

i create my object an add it to a container (not via zmi).
i do the notify(ObjectCreatedEvent(container[myobjectname]) thing, to let the
intid and catalog do their indexing stuff.
i look at the Catalog statistics in the zmi, where is see, that one item is 
indexed.
but when i delete the object (i used
notifiy(ObjectRemovedEvent(container[myobjectname])), there is still something
residing in the index, which causes a KeyError in the intid utility, when it
trys to getObject.

It seems, that the index is indexing the object and the adapter via the same
unique intid, and then deletes only the objects index, and not the adapter?

since my adapter is only accessing annotations on the object, i could feed the
index directly via the annotation value, but that goes against the use of
adapters and the idea, not to change the object implementation.

Do you have any idea, what i have to do?
Did i forget an event? or something else?

thanks
cheers Dominique
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users