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
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,
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
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,
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
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
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
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