CMFUid should call reindexObject on the object getting a uid, not on the catalog

Bug #290982 reported by David Glick
4
Affects Status Importance Assigned to Milestone
Zope CMF buildout
Fix Released
Low
Unassigned

Bug Description

Currently when the UniqueIdHandlerTool adds a uid to an object, it reindexes that object so the uid catalog can be updated. However, it does so by calling portal_catalog.reindexObject rather than the reindexObject of the object getting the uid. This makes a difference in the case of objects like the portal root which should never be catalogued, and thus do not subclass CMFCatalogAware and have empty indexing methods. The current CMFUid behavior results in such objects getting catalogued anyway.

I'm attaching a patch which fixes this by trying to call the reindexObject attribute of the object getting the uid. I now have zope svn access and am happy to commit this, but wanted to make sure it is reviewed first as it would be my first CMF contribution.

Tags: catalog cmfuid
Revision history for this message
David Glick (davisagli) wrote :
Revision history for this message
Tres Seaver (tseaver) wrote : Re: [Bug 290982] [NEW] CMFUid should call reindexObject on the object getting a uid, not on the catalog

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Glick wrote:
> Public bug reported:
>
> Currently when the UniqueIdHandlerTool adds a uid to an object, it
> reindexes that object so the uid catalog can be updated. However, it
> does so by calling portal_catalog.reindexObject rather than the
> reindexObject of the object getting the uid. This makes a difference in
> the case of objects like the portal root which should never be
> catalogued, and thus do not subclass CMFCatalogAware and have empty
> indexing methods. The current CMFUid behavior results in such objects
> getting catalogued anyway.
>
> I'm attaching a patch which fixes this by trying to call the
> reindexObject attribute of the object getting the uid. I now have zope
> svn access and am happy to commit this, but wanted to make sure it is
> reviewed first as it would be my first CMF contribution.

+1. The patch (including the test, thank you!) looks fine.

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJCcsv+gerLs4ltQ4RAmQ+AKCP+/V5OP18TcNo+IM7TmHRaVFc3gCfZV/g
9nEqAZFnxiOhfPB2yak2Jew=
=sgMo
-----END PGP SIGNATURE-----

Revision history for this message
Jens Vagelpohl (dataflake-deactivatedaccount-deactivatedaccount) wrote :

The fix was checked in several days ago:

http://svn.zope.org/?rev=92707&view=rev

Changed in zope-cmf:
importance: Undecided → Low
milestone: none → 2.2.0
status: New → Fix Released
Revision history for this message
Lukas Graf (lukasgraf) wrote :

Is there a particular reason why the newly added `obj.reindexObject()` isn't restricted to only rebuild the UID_ATTRIBUTE_NAME index? (Like `obj.reindexObject(idxs=[self.UID_ATTRIBUTE_NAME ])`, the same way the existing `_reindexObject` method does it.

Right now, this change causes ALL indexes to be rebuilt when `_setUid()` is called, including the expensive SearchableText.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.