Commit eb9bbba2 authored by Julien Muchembled's avatar Julien Muchembled

Add Zope 2.12 monkey-patch to really fix LP #143531

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45001 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da2b58c1
......@@ -51,6 +51,7 @@ from Products.ERP5Type.patches import CMFCoreSkinnable
from Products.ERP5Type.patches import CMFCoreSkinsTool
from Products.ERP5Type.patches import CMFBTreeFolder
from Products.ERP5Type.patches import OFSFolder
from Products.ERP5Type.patches import OFSUninstalled
from Products.ERP5Type.patches import PersistentMapping
from Products.ERP5Type.patches import DateTimePatch
from Products.ERP5Type.patches import PythonScript
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
# See https://launchpad.net/bugs/143531
from OFS import Uninstalled
if '__getstate__' not in Uninstalled.BrokenClass.__dict__:
from ZODB.broken import persistentBroken, PersistentBroken
from persistent import Persistent
from threading import RLock
Uninstalled.broken_klasses_lock = lock = RLock()
Uninstalled_Broken = Uninstalled.Broken
cache = Uninstalled.broken_klasses
def Broken(self, oid, pair):
lock.acquire()
try:
cached = pair in cache
result = Uninstalled_Broken(self, oid, pair)
if not cached:
klass = cache.pop(pair)
assert not issubclass(klass, PersistentBroken), \
"This monkey-patch is not useful anymore"
cache[pair] = persistentBroken(klass)
finally:
lock.release()
return result
Uninstalled.Broken = Broken
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