Commit 154817ed authored by Andreas Jung's avatar Andreas Jung

providing a fallback for safe_callable() when ZCatalog is used outside Zope

parent ca33bdd3
......@@ -32,6 +32,24 @@ from Products.PluginIndexes.common.randid import randid
import time, sys, types
from bisect import bisect
# Collector #771: provide a safe_callable() method with a
# fallback (when ZCatalog might be used outside Zope)
try:
from DocumentTemplate.cDocumentTemplate import safe_callable
except:
def safe_callable(ob):
# Works with ExtensionClasses and Acquisition.
if hasattr(ob, '__class__'):
if hasattr(ob, '__call__'):
return 1
else:
return type(ob) in ClassTypes
else:
return callable(ob)
class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
""" An Object Catalog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment