Commit a9346784 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Kirill Smelkov

use ZODB.utils.get_pickle_metadata instead of pickle.Unpickler.

* it is faster.
* it does not require Products.
parent 5fd2c0eb
......@@ -2,22 +2,9 @@
# Based on a transaction analyzer by Matt Kromer.
import pickle
import re
import sys
import types
from ZODB.FileStorage import FileStorage
from cStringIO import StringIO
class FakeError(Exception):
def __init__(self, module, name):
self.module = module = name
class FakeUnpickler(pickle.Unpickler):
def find_class(self, module, name):
raise FakeError(module, name)
from ZODB.utils import get_pickle_metadata
class Report:
def __init__(self):
......@@ -97,18 +84,8 @@ def analyze_trans(report, txn):
analyze_rec(report, rec)
def get_type(record):
unpickled = FakeUnpickler(StringIO(
except FakeError, err:
return "%s.%s" % (err.module,
classinfo = unpickled[0]
if isinstance(classinfo, types.TupleType):
mod, klass = classinfo
return "%s.%s" % (mod, klass)
return str(classinfo)
mod, klass = get_pickle_metadata(
return "%s.%s" % (mod, klass)
def analyze_rec(report, record):
oid = record.oid
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