[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ Avoid a DT dependency and make the code the exact same
Hanno Schlichting
hannosch at hannosch.eu
Sat Dec 25 13:07:37 EST 2010
Log message for revision 119093:
Avoid a DT dependency and make the code the exact same
Changed:
U Products.ZCatalog/trunk/src/Products/PluginIndexes/common/__init__.py
U Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
-=-
Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/common/__init__.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/common/__init__.py 2010-12-25 18:06:00 UTC (rev 119092)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/common/__init__.py 2010-12-25 18:07:36 UTC (rev 119093)
@@ -11,18 +11,12 @@
#
#############################################################################
-# This code is duplicated here from Products/ZCatalog/Catalog.py to avoid a
-# unnecessary dependency on ZCatalog.
import types
-try:
- from DocumentTemplate.cDocumentTemplate import safe_callable
-except ImportError:
- def safe_callable(ob):
- # Works with ExtensionClasses and Acquisition.
- if hasattr(ob, '__class__'):
- if hasattr(ob, '__call__'):
- return 1
- else:
- return isinstance(ob, types.ClassType)
- else:
- return callable(ob)
+
+
+def safe_callable(ob):
+ # Works with ExtensionClasses and Acquisition.
+ if hasattr(ob, '__class__'):
+ return hasattr(ob, '__call__') or isinstance(ob, types.ClassType)
+ else:
+ return callable(ob)
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py 2010-12-25 18:06:00 UTC (rev 119092)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py 2010-12-25 18:07:36 UTC (rev 119093)
@@ -38,16 +38,12 @@
LOG = logging.getLogger('Zope.ZCatalog')
-try:
- from DocumentTemplate.cDocumentTemplate import safe_callable
-except ImportError:
- # Fallback to python implementation to avoid dependancy on DocumentTemplate
- def safe_callable(ob):
- # Works with ExtensionClasses and Acquisition.
- if hasattr(ob, '__class__'):
- return hasattr(ob, '__call__') or isinstance(ob, types.ClassType)
- else:
- return callable(ob)
+def safe_callable(ob):
+ # Works with ExtensionClasses and Acquisition.
+ if hasattr(ob, '__class__'):
+ return hasattr(ob, '__call__') or isinstance(ob, types.ClassType)
+ else:
+ return callable(ob)
class CatalogError(Exception):
More information about the checkins
mailing list