Commit 6979c6d8 authored by Julien Muchembled's avatar Julien Muchembled

Generate Zope2.12-like class representation on xml export of BTrees objects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38488 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2cef8616
......@@ -14,6 +14,7 @@
# Make sure the xml export will be ordered
import re
from ZODB.utils import u64, p64
from Shared.DC.xml import ppml
from base64 import encodestring
......@@ -68,9 +69,11 @@ class OrderedPickler(Pickler):
from ExtensionClass import Base
Base__getnewargs__ = getattr(Base, '__getnewargs__', None)
if Base__getnewargs__ is None:
is_old_btree = lambda pickle: None
def maybeSimplifyClass(klass):
return klass
else:
is_old_btree = re.compile('cBTrees\\._(..)BTree\n(\\1)BTree\n').match
def maybeSimplifyClass(klass):
if isinstance(klass, tuple):
pureclass, newargs = klass
......@@ -122,6 +125,8 @@ def reorderPickle(jar, p):
obj = unpickler.load()
pickler.dump(obj)
p=newp.getvalue()
if is_old_btree(p):
p = p.replace('_','',1)
return obj, p
def XMLrecord(oid, plen, p, id_mapping):
......
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