Commit eda11559 authored by Kirill Smelkov's avatar Kirill Smelkov

scripts/fsrefs: De-globalify verbose

As noted in recent commit, verbose option handling in fsrefs.py was
broken. On review Tres suggested to make VERBOSE a local variable as
currently it is used only in one function main().

Suggested-by: Tres Seaver
parent c6ebb373
...@@ -70,8 +70,6 @@ from ZODB.utils import u64, oid_repr, get_pickle_metadata ...@@ -70,8 +70,6 @@ from ZODB.utils import u64, oid_repr, get_pickle_metadata
from ZODB.serialize import get_refs from ZODB.serialize import get_refs
from ZODB.POSException import POSKeyError from ZODB.POSException import POSKeyError
VERBOSE = 0
# There's a problem with oid. 'data' is its pickle, and 'serial' its # There's a problem with oid. 'data' is its pickle, and 'serial' its
# serial number. 'missing' is a list of (oid, class, reason) triples, # serial number. 'missing' is a list of (oid, class, reason) triples,
# explaining what the problem(s) is(are). # explaining what the problem(s) is(are).
...@@ -94,7 +92,7 @@ def report(oid, data, serial, missing): ...@@ -94,7 +92,7 @@ def report(oid, data, serial, missing):
print() print()
def main(path=None): def main(path=None):
global VERBOSE verbose = 0
if path is None: if path is None:
import sys import sys
import getopt import getopt
...@@ -102,7 +100,7 @@ def main(path=None): ...@@ -102,7 +100,7 @@ def main(path=None):
opts, args = getopt.getopt(sys.argv[1:], "v") opts, args = getopt.getopt(sys.argv[1:], "v")
for k, v in opts: for k, v in opts:
if k == "-v": if k == "-v":
VERBOSE += 1 verbose += 1
path, = args path, = args
...@@ -128,7 +126,7 @@ def main(path=None): ...@@ -128,7 +126,7 @@ def main(path=None):
except POSKeyError: except POSKeyError:
undone[oid] = 1 undone[oid] = 1
except: except:
if VERBOSE: if verbose:
traceback.print_exc() traceback.print_exc()
noload[oid] = 1 noload[oid] = 1
......
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