Commit eeb590a4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! Zope2: revive patches for Zope2.

parent fa423199
......@@ -33,6 +33,11 @@
from __future__ import absolute_import
from App.config import getConfiguration
from .patches import python, globalrequest, Pandas
from App.version_txt import getZopeVersion
if getZopeVersion()[0] == 2: # BBB Zope2
IS_ZOPE2 = True
else:
IS_ZOPE2 = False
import six
if six.PY2:
from .patches import pylint
......@@ -45,12 +50,6 @@ if six.PY3:
else:
WITH_LEGACY_WORKFLOW = True
from App.version_txt import getZopeVersion
if getZopeVersion()[0] == 2: # BBB Zope2
IS_ZOPE2 = True
else:
IS_ZOPE2 = False
# We have a name conflict with source_reference and destination_reference,
# which are at the same time property accessors for 'source_reference'
# property, and category accessors (similar to getSourceValue().getReference())
......
......@@ -20,6 +20,7 @@
from __future__ import absolute_import
import sys
from Products.ERP5Type import IS_ZOPE2
# TODO: make sure that trying to use it does not import isort, because the
# latter hacks Python in order to execute:
......@@ -439,6 +440,25 @@ def fail_hook_BTrees(modname):
return astng
MANAGER.register_failed_import_hook(fail_hook_BTrees)
if IS_ZOPE2: # BBB Zope2
# No name 'OOBTree' in module 'BTrees.OOBTree' (no-name-in-module)
# Unable to import 'BTrees.OOBTree' (import-error)
#
# When the corresponding C Extension (BTrees._Foo) is available, update
# BTrees.Foo namespace from the C extension, otherwise use Python definitions
# by dropping the `Py` suffix in BTrees.Foo symbols.
import BTrees
for module_name, module in inspect.getmembers(BTrees, inspect.ismodule):
if module_name[0] != '_':
continue
try:
extended_module = BTrees.__dict__[module_name[1:]]
except KeyError:
continue
else:
_register_module_extender_from_live_module(extended_module.__name__,
module)
# No name 'ElementMaker' in module 'lxml.builder' (no-name-in-module)
#
# imp.load_dynamic() on .so file
......
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