Commit 1f4c6429 authored by Alessandro Pisa's avatar Alessandro Pisa Committed by GitHub

Fix TypeError for fsoids (#351)

Fix `TypeError: can't concat str to bytes` when running fsoids.py script with Python 3.

Closes #350
parent e370b43f
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
5.6.1 (unreleased) 5.6.1 (unreleased)
================== ==================
- Fix ``TypeError: can't concat str to bytes`` when running fsoids.py script with Python 3.
See `issue 350 <https://github.com/zopefoundation/ZODB/issues/350>`_.
- Readd transaction size information to ``fsdump`` output; - Readd transaction size information to ``fsdump`` output;
adapt `fsstats` to ``fsdump``'s exchanged order for ``size`` and ``class`` adapt `fsstats` to ``fsdump``'s exchanged order for ``size`` and ``class``
information in data records; information in data records;
......
...@@ -29,7 +29,11 @@ def shorten(s, size=50): ...@@ -29,7 +29,11 @@ def shorten(s, size=50):
navail = size - 5 navail = size - 5
nleading = navail // 2 nleading = navail // 2
ntrailing = size - nleading ntrailing = size - nleading
return s[:nleading] + " ... " + s[-ntrailing:] if isinstance(s, bytes):
sep = b" ... "
else:
sep = " ... "
return s[:nleading] + sep + s[-ntrailing:]
class Tracer(object): class Tracer(object):
"""Trace all occurrences of a set of oids in a FileStorage. """Trace all occurrences of a set of oids in a FileStorage.
......
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