Update of /cvsroot/webware/Webware/MiscUtils
In directory usw-pr-cvs1:/tmp/cvs-serv21169
Modified Files:
PickleCache.py
Log Message:
- comment most of the "if v: print" verbose print statements since they're
rarely used (but still useful for future debugging)
Index: PickleCache.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiscUtils/PickleCache.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PickleCache.py 11 Nov 2002 02:15:00 -0000 1.1
--- PickleCache.py 11 Nov 2002 03:02:40 -0000 1.2
***************
*** 92,96 ****
if not os.path.exists(filename):
! if v: print 'cannot find %r' % filename
open(filename) # to get a properly constructed IOError
--- 92,96 ----
if not os.path.exists(filename):
! #if v: print 'cannot find %r' % filename
open(filename) # to get a properly constructed IOError
***************
*** 103,139 ****
if os.path.exists(picklePath):
if os.path.getmtime(picklePath)<os.path.getmtime(filename):
! if v: print 'cache is out of date'
shouldDeletePickle = 1
else:
try:
! if v: print 'about to open for read %r' % picklePath
file = open(picklePath)
except IOError, e:
! if v: print 'cannot open cache file: %s: %s' % (e.__class__.__name__, e)
pass
else:
try:
! if v: print 'about to load'
dict = load(file)
except EOFError:
! if v: print 'EOFError - not loading'
shouldDeletePickle = 1
else:
file.close()
! if v: print 'finished reading'
assert isinstance(dict, DictType), 'type=%r dict=%r' % (type(dict), dict)
for key in ('source', 'data', 'pickle version', 'python version'):
assert dict.has_key(key), key
if source and dict['source']!=source:
! if v: print 'not from required source (%s): %s' % (source, dict['source'])
shouldDeletePickle = 1
elif dict['pickle version']!=pickleVersion:
! if v: print 'pickle version (%i) does not match expected (%i)' % (dict['pickle version'], pickleVersion)
shouldDeletePickle = 1
elif dict['python version']!=sys.version_info:
! if v: print 'python version %s does not match current %s' % (dict['python version'], sys.version_info)
shouldDeletePickle = 1
else:
! if v: print 'all tests pass. accepting data'
if v>1:
print 'display full dict:'
--- 103,139 ----
if os.path.exists(picklePath):
if os.path.getmtime(picklePath)<os.path.getmtime(filename):
! #if v: print 'cache is out of date'
shouldDeletePickle = 1
else:
try:
! #if v: print 'about to open for read %r' % picklePath
file = open(picklePath)
except IOError, e:
! #if v: print 'cannot open cache file: %s: %s' % (e.__class__.__name__, e)
pass
else:
try:
! #if v: print 'about to load'
dict = load(file)
except EOFError:
! #if v: print 'EOFError - not loading'
shouldDeletePickle = 1
else:
file.close()
! #if v: print 'finished reading'
assert isinstance(dict, DictType), 'type=%r dict=%r' % (type(dict), dict)
for key in ('source', 'data', 'pickle version', 'python version'):
assert dict.has_key(key), key
if source and dict['source']!=source:
! #if v: print 'not from required source (%s): %s' % (source, dict['source'])
shouldDeletePickle = 1
elif dict['pickle version']!=pickleVersion:
! #if v: print 'pickle version (%i) does not match expected (%i)' % (dict['pickle version'], pickleVersion)
shouldDeletePickle = 1
elif dict['python version']!=sys.version_info:
! #if v: print 'python version %s does not match current %s' % (dict['python version'], sys.version_info)
shouldDeletePickle = 1
else:
! #if v: print 'all tests pass. accepting data'
if v>1:
print 'display full dict:'
***************
*** 145,149 ****
if shouldDeletePickle:
try:
! if v: print 'attempting to remove pickle cache file'
os.remove(picklePath)
except OSError, e:
--- 145,149 ----
if shouldDeletePickle:
try:
! #if v: print 'attempting to remove pickle cache file'
os.remove(picklePath)
except OSError, e:
|