Commit ad5243f0 authored by Jim Fulton's avatar Jim Fulton

Added logic to check the file header (for non-export files). This

generates a hope-fully informative error if somebody tries to
use the utility with a file that is not a bobobase (ZODB 2) file, they
get an error message. A number of people have been trying to use bbb.py
with ZODB 3 file storage files.
parent 54dfbf27
......@@ -115,6 +115,21 @@ def _read_and_report(file, rpt=None, fromEnd=0, both=0, n=99999999, show=0,
find=string.find
seek(0,2)
file_size=file.tell()
if not export:
seek(0)
h=read(len(packed_version))
if h != packed_version:
if h[:4]=='FS21':
error("The input file is a ZODB File Storage\n"
"This script only works with ZODB 2 (BoboPOS) "
"data or export files."
,1)
else:
error("The input file is not a ZODB 2 database file.\n"
"This script only works with ZODB 2 (BoboPOS) "
"data or export files."
,1)
gmtime=time.gmtime
if fromEnd: pos=file_size
......
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