Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
95c9e5f5
Commit
95c9e5f5
authored
Sep 13, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the bogus short_repr(); a much nicer one is in the standard
repr module.
parent
40f1a033
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
21 deletions
+2
-21
src/ZEO/zrpc/log.py
src/ZEO/zrpc/log.py
+2
-21
No files found.
src/ZEO/zrpc/log.py
View file @
95c9e5f5
...
...
@@ -24,24 +24,5 @@ def new_label():
def
log
(
message
,
level
=
zLOG
.
BLATHER
,
label
=
None
,
error
=
None
):
zLOG
.
LOG
(
label
or
_label
,
level
,
message
,
error
=
error
)
REPR_LIMIT
=
40
def
short_repr
(
obj
):
"Return an object repr limited to REPR_LIMIT bytes."
# Some of the objects being repr'd are large strings. It's wastes
# a lot of memory to repr them and then truncate, so special case
# them in this function.
# Also handle short repr of a tuple containing a long string.
if
isinstance
(
obj
,
types
.
StringType
):
obj
=
obj
[:
REPR_LIMIT
]
elif
isinstance
(
obj
,
types
.
TupleType
):
elts
=
[]
size
=
0
for
elt
in
obj
:
r
=
repr
(
elt
)
elts
.
append
(
r
)
size
+=
len
(
r
)
if
size
>
REPR_LIMIT
:
break
obj
=
tuple
(
elts
)
return
repr
(
obj
)[:
REPR_LIMIT
]
# There's a nice "short_repr" function in the repr module:
from
repr
import
repr
as
short_repr
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