Commit 391225d8 authored by Jim Fulton's avatar Jim Fulton

Fixed a bad-magic-number exception message .

(Thanks to Patrick Strawderman for pointing this out and providing an
initial fix.)
parent 38d7c873
......@@ -242,7 +242,8 @@ class ClientCache(object):
write = f.write
seek(0)
if read(4) != magic:
raise ValueError("unexpected magic number: %r" % magic)
seek(0)
raise ValueError("unexpected magic number: %r" % read(4))
self.tid = read(8)
if len(self.tid) != 8:
raise ValueError("cache file too small -- no tid at start")
......
......@@ -481,6 +481,14 @@ __test__ = dict(
>>> logger.removeHandler(handler)
>>> cache.close()
""",
bad_magic_number =
r"""
>>> open('cache', 'w').write("Hi world!")
>>> cache = ZEO.cache.ClientCache('cache', 1000)
Traceback (most recent call last):
...
ValueError: unexpected magic number: 'Hi w'
"""
)
......
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