Commit 3e774c47 authored by Jérome Perrin's avatar Jérome Perrin

patches: make Shared.DC.Scripts.Bindings and ZPublisher.BeforeTraverse.MultiHook new-style classes

This backports parts of zope commit bb7837c66 (Explicitly make all
classes new-style., 2017-09-15) and 173658008 (Fix unpickling of instances
those base class changed to a new-style class. (#208), 2017-10-24).

This is done for two reasons:
 - so that business template XML are same when exported from zope4
   and from zope2
 - so that a business template created from zope4 can still be
   installed on zope2.
parent e53bf75e
...@@ -99,6 +99,8 @@ from Products.ERP5Type.patches import users ...@@ -99,6 +99,8 @@ from Products.ERP5Type.patches import users
from Products.ERP5Type.patches import Publish from Products.ERP5Type.patches import Publish
from Products.ERP5Type.patches import WSGITask from Products.ERP5Type.patches import WSGITask
from Products.ERP5Type.patches import urllib_opener from Products.ERP5Type.patches import urllib_opener
from Products.ERP5Type.patches import SharedDCScriptsBindings
from Products.ERP5Type.patches import ZPublisherBeforeTraverse
# These symbols are required for backward compatibility # These symbols are required for backward compatibility
from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager
......
import Shared.DC.Scripts.Bindings
# Make Shared.DC.Scripts.Bindings a new style classes already on Zope2, so that
# we can install business templates exported on Zope4 in Zope2 instances.
_NameAssignments = Shared.DC.Scripts.Bindings.NameAssignments
if not isinstance(_NameAssignments, type):
class NameAssignments(_NameAssignments, object):
def __init__(self, mapping=None):
if mapping is None:
mapping = {}
_NameAssignments.__init__(self, mapping)
NameAssignments.__module__ = _NameAssignments.__module__
Shared.DC.Scripts.Bindings.NameAssignments = NameAssignments
import ZPublisher.BeforeTraverse
# Make ZPublisher.BeforeTraverse.MultiHook a new style classes already on
# Zope2, so that we can install business templates exported on Zope4 in
# Zope2 instances.
_MultiHook = ZPublisher.BeforeTraverse.MultiHook
if not isinstance(_MultiHook, type):
class MultiHook(_MultiHook, object):
def __init__(self, hookname='<undefined hookname>', prior=None,
defined_in_class=False):
_MultiHook.__init__(self, hookname, prior, defined_in_class)
MultiHook.__module__ = _MultiHook.__module__
ZPublisher.BeforeTraverse.MultiHook = MultiHook
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