On Fri, 2011-06-24 at 00:12 +0200, Thierry Florac wrote:
> You don't have to subscribe to IContainerModifiedEvent or
> IObjectModifiedEvent: zope.intid and zope.catalog packages already
> provide subscribers for these events to automatically handle updates
> of indexes.
>
> What you have to do is just to generate an ObjectAddedEvent or
> ObjectModifiedEvent when your object is added or modified, and notify
> subscribers for it:
When I add my object to its container via zope.formlib AddForm's
createAndAdd method like this
cl = Client()
...
self.context[cid] = cl
(P.S: I didn't explicitly notify the ObjectAddedEvent.)
In setitem function of zope.container.contained
'notify(ObjectAddedEvent)' happens, this causes the 'addIntIdSubscriber'
adapter of zope.intid to be called. This in turn registers the 'Client'
object and notifies for 'IntIdAddedEvent'.
But I don't see the 'indexDocSubscriber' of zope.catalog.catalog which
is the adapter for 'IIntIdAddedEvent' being called. Why is this so?
So, sm['intids'] is getting updated as and when new objects are added
but the catalog indexes are not getting updated. Am I missing something?
Or is there any specific zcml configuration needed for this?
Please guide me.
--
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
Hello
On Fri, 2011-06-24 at 12:17 +0200, Christian Klinger wrote:
> what do you mean with "via zope.formlib AddForms's createAndAdd' method.
>
> Do you override this method? If so this is wrong you only have to
> add a create method which get's called before the object is persisted in
> the container. The createAndAdd method triggers then the catalog.
Oh!! I never knew that. I was following the bluebream documentation at
http://bluebream.zope.org/doc/1.0/tutorial2.html#adding-tickets there
they were overriding the 'createAndAdd' method of AddForm.
Anyways I'll try the 'create' method and get back.
Thanks
--
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
Hello all,
I did the following while adding a new site
sm = site.getSiteManager()
intids = IntIds()
sm['intids'] = intids
sm.registerUtility(intids, IIntIds)
cat = Catalog()
sm['catalog'] = cat
sm.registerUtility(cat, ICatalog)
cat[u'client_name'] = TextIndex('name', IClient)
I ran into the debug shell prompt and checked the length of sm['initid']
after adding 'Client' objects via browser interface. It did reflected
the number of items added. But when I ran a search query in the shell
prompt there were no results
>>> len(sm['intids'])
4
>>> list(cat.apply({'client_name': 'xyz*'}))
[]
But when I updated the indexes, it gave out results.
>>> cat.updateIndexes()
>>> list(cat.apply({'client_name': 'xyz*'}))
[753759381]
I guess that I don't have to manually update the indexes each time when
an object is added/modified. Am I missing something?
--
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
On behalf of the Plone and Zope Security Teams I'd like to draw your
attention to a security announcement that has just been published.
This is a pre-announcement only, it does not contain any vulnerability
details. Your sites are a safe today as they were yesterday. However,
as the problem that has been found is so serious we are giving you
advance warning that a patch is upcoming and recommending that you
plan a maintenance period for your sites to coincide with the full
announcement on Tuesday next week.
Full details are available at
http://plone.org/products/plone/security/advisories/pre-announcement-201106…
You can feel free to ask more questions on the plone-users mailing
list or in the #plone IRC channel about details and how to protect
yourself, but it is important to make a plan for this now. It is
important to plan down-time at the time specified in that announcement
or your site will potentially be at risk - following the release of a
hotfix for the previous serious security vulnerability we received
reports of automated attacks on unpatched sites.
Laurence