Allow supybot.directories.backup to be /dev/null.

This commit is contained in:
Valentin Lorentz 2012-03-15 20:22:46 +01:00
parent 63bc155750
commit a5e8f8ede8
3 changed files with 5 additions and 3 deletions

View File

@ -763,7 +763,8 @@ registerGlobalValue(supybot.directories, 'data',
Directory('data', _("""Determines what directory data is put into."""))) Directory('data', _("""Determines what directory data is put into.""")))
registerGlobalValue(supybot.directories, 'backup', registerGlobalValue(supybot.directories, 'backup',
Directory('backup', _("""Determines what directory backup data is put Directory('backup', _("""Determines what directory backup data is put
into."""))) into. Set it to /dev/null (this is a special value; it is a special value,
so it also works on Windows and systems without /dev/null).""")))
registerGlobalValue(supybot.directories.data, 'tmp', registerGlobalValue(supybot.directories.data, 'tmp',
DataFilenameDirectory('tmp', _("""Determines what directory temporary files DataFilenameDirectory('tmp', _("""Determines what directory temporary files
are put into."""))) are put into.""")))

View File

@ -171,7 +171,8 @@ class AtomicFile(file):
if newSize or self.allowEmptyOverwrite or not originalExists: if newSize or self.allowEmptyOverwrite or not originalExists:
if originalExists: if originalExists:
oldSize = os.path.getsize(self.filename) oldSize = os.path.getsize(self.filename)
if self.makeBackupIfSmaller and newSize < oldSize: if self.makeBackupIfSmaller and newSize < oldSize and \
self.backupDir != '/dev/null':
now = int(time.time()) now = int(time.time())
backupFilename = '%s.backup.%s' % (self.filename, now) backupFilename = '%s.backup.%s' % (self.filename, now)
if self.backupDir is not None: if self.backupDir is not None:

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+limnoria (2012-03-15T12:44:43+0000)' version = '0.83.4.1+limnoria (2012-03-15T19:22:46+0000)'