[Product-Developers] Re: POSKeyError when indexing using External Method
Maurits van Rees
m.van.rees at zestsoftware.nl
Thu Mar 4 23:18:49 UTC 2010
Neil Stokes, on 2010-02-27:
> I have an external method that exposes the last editor attribute of all
> objects in the site. Code is as follows:
> def last_editor(self):
> """Return the last editor of an object."""
> if jar is None or oid is None: return None
> return result
That looks far too low level. Can't you just do something like this
wtool = getToolByName(self, 'portal_workflow')
review_history = wtool.getInfoFor(self, 'review_history', )
if not review_history:
last_change = review_history[-1]
I wrote this by looking at
> If I now go back to my site and create a new object of one of the indexable
> classes (Folder or my own object class ArchiveImage) I get a POSKeyError.
> This only occurs when adding an indexable object...I can add objects of
> other classes with no problem.
> If I delete the index, I can then add items of those classes again, so it
> seems there is a problem whereby the zope does not know how to update the
> index. I suspect that zope is attempting to update the index before
> committing the new object to the database, and that causes the error since
> the OID is not found.
Sounds plausible to me.
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
What are you going to create today?
More information about the Product-Developers