Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Frederic Thoma
erp5
Commits
26c4aaeb
Commit
26c4aaeb
authored
Mar 14, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use ZODB.utils.get_pickle_metadata instead of pickle.Unpickler.
* it is faster. * it does not require Products.
parent
88cd32df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
26 deletions
+3
-26
erp5/util/zodbanalyze/__init__.py
erp5/util/zodbanalyze/__init__.py
+3
-26
No files found.
erp5/util/zodbanalyze/__init__.py
View file @
26c4aaeb
...
...
@@ -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
):
Exception
.
__init__
(
self
)
self
.
module
=
module
self
.
name
=
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
):
try
:
unpickled
=
FakeUnpickler
(
StringIO
(
record
.
data
)).
load
()
except
FakeError
,
err
:
return
"%s.%s"
%
(
err
.
module
,
err
.
name
)
except
:
raise
classinfo
=
unpickled
[
0
]
if
isinstance
(
classinfo
,
types
.
TupleType
):
mod
,
klass
=
classinfo
mod
,
klass
=
get_pickle_metadata
(
record
.
data
)
return
"%s.%s"
%
(
mod
,
klass
)
else
:
return
str
(
classinfo
)
def
analyze_rec
(
report
,
record
):
oid
=
record
.
oid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment