Thomas Guettler wrote:

Hi!

In KeywordIndex the newKeywords get called
if they are "callable":
    def _get_object_keywords(self,obj):
        newKeywords = getattr(obj, self.id, ())
        if callable(newKeywords):               # (*)
			newKeywords = newKeywords()
        if hasattr(newKeywords,'capitalize'): # is it string-like ?
            newKeywords = (newKeywords, )
        return newKeywords

This fails if the newKeywords are stored in a PersistentList.

Callable is true, but there is no __call__ attribute.

I changed the line marked with (*) to
 if hasattr(newKeyword, "__call__"):

and this seems to work

I think this does not break anything and could be included in the
original.

Am I the first how uses PersistentList for an indexed attribute? Is
there a reason not to do so?

The KeywordIndex should be changed to check for the __call__ attribute, rather than relying on 'callable'. You cannot reliably use 'callable' when you're also using acquisition wrappers.

See my comment to this Collector report.

http://collector.zope.org/Zope/578

I suggest you report the bug you have found in the Collector.

--
Steve Alexander




_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )

Reply via email to