Oops, closed is reserved, apparently.

This commit is contained in:
Jeremy Fincher 2004-07-31 12:14:36 +00:00
parent f349f08111
commit 0fcb77243e

View File

@ -163,9 +163,6 @@ def timeElapsed(elapsed, leadingZeroes=False, years=True, weeks=True,
ret.append(nItems('second', secs)) ret.append(nItems('second', secs))
if len(ret) == 0: if len(ret) == 0:
raise ValueError, 'Time difference not great enough to be noted.' raise ValueError, 'Time difference not great enough to be noted.'
if len(ret) == 1:
return ret[0]
else:
return commaAndify(ret) return commaAndify(ret)
def distance(s, t): def distance(s, t):
@ -681,7 +678,6 @@ class AtomicFile(file):
Opens the file in 'w' mode.""" Opens the file in 'w' mode."""
def __init__(self, filename, allowEmptyOverwrite=False): def __init__(self, filename, allowEmptyOverwrite=False):
self.filename = filename self.filename = filename
self.closed = False
self.rolledback = False self.rolledback = False
self.allowEmptyOverwrite = allowEmptyOverwrite self.allowEmptyOverwrite = allowEmptyOverwrite
self.tempFilename = '%s.%s' % (filename, mktemp()) self.tempFilename = '%s.%s' % (filename, mktemp())
@ -692,7 +688,7 @@ class AtomicFile(file):
if not self.closed: if not self.closed:
super(AtomicFile, self).close() super(AtomicFile, self).close()
if os.path.exists(self.tempFilename): if os.path.exists(self.tempFilename):
print 'AtomicFile: Removing %s.' % self.tempFilename #print 'AtomicFile: Removing %s.' % self.tempFilename
os.remove(self.tempFilename) os.remove(self.tempFilename)
self.rolledback = True self.rolledback = True
@ -700,7 +696,6 @@ class AtomicFile(file):
#print 'AtomicFile.close' #print 'AtomicFile.close'
if not self.rolledback: if not self.rolledback:
#print 'AtomicFile.close: actually closing.' #print 'AtomicFile.close: actually closing.'
self.closed = True
super(AtomicFile, self).close() super(AtomicFile, self).close()
size = os.stat(self.tempFilename).st_size size = os.stat(self.tempFilename).st_size
if size or self.allowEmptyOverwrite: if size or self.allowEmptyOverwrite: