Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-25 Thread Jeremy Hylton
JPS == Jeffrey P Shell Jeffrey writes: JPS What about ``if callable(aq_base(newKeywords)):`` to remove JPS potential acquisition wrappers? callable() returns True for any instance. Since PersistentList is an instance, you can't use callable() to determine whether it is callable. Jeremy

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-25 Thread Steve Alexander
Jeremy Hylton wrote: JPS == Jeffrey P Shell writes: JPS What about ``if callable(aq_base(newKeywords)):`` to remove JPS potential acquisition wrappers? callable() returns True for any instance. Any instance of what? [steve@localhost]$ python2.2 Python 2.2.2 (#1, Oct 31 2002,

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-25 Thread Jeremy Hylton
It must be any instance of an ExtensionClass. I think Python instances used to be true-for-callable as well, but that must have been fixed. Python 2.1.3 (#5, Aug 15 2002, 10:41:31) [GCC 2.95.3 19991030 (prerelease)] on linux2 Type copyright, credits or license for more information. from

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-25 Thread Chris McDonough
There is a workaround for this in the DocumentTemplate package. It implements a safe_callable function that seems to do the right thing with ext class instances: def safe_callable(ob): # Works with ExtensionClasses and Acquisition. if hasattr(ob, '__class__'): if hasattr(ob,

[Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-20 Thread Thomas Guettler
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

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-20 Thread Steve Alexander
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

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-20 Thread Casey Duncan
Just a note that this can't be put in Zope 2.6 since functions and methods don't have a __call__ in Python 2.1. -Casey On Wednesday 20 November 2002 02:33 pm, Steve Alexander wrote: Thomas Guettler wrote: Hi! In KeywordIndex the newKeywords get called if they are callable: def

Re: [Zope-dev] KeywordIndex and PersistentList (Bug?)

2002-11-20 Thread Jeffrey P Shell
What about ``if callable(aq_base(newKeywords)):`` to remove potential acquisition wrappers? On Wednesday, November 20, 2002, at 12:41 PM, Casey Duncan wrote: Just a note that this can't be put in Zope 2.6 since functions and methods don't have a __call__ in Python 2.1. -Casey On Wednesday