diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 13:41:39 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-08-08 13:41:39 +0200 |
commit | 0c110fb2a29568906d11b652ac28845a866550fd (patch) | |
tree | 031de16ad8fa2fd02a90b4f6b0fe2940c534de50 /pyfirstaidkit/utils/backup.py | |
parent | a7894d08a35c14c8e6c2cc9b4c5a6e4382643846 (diff) | |
download | firstaidkit-0c110fb2a29568906d11b652ac28845a866550fd.tar.gz firstaidkit-0c110fb2a29568906d11b652ac28845a866550fd.tar.xz firstaidkit-0c110fb2a29568906d11b652ac28845a866550fd.zip |
Manage the persistent backup with a class of its own.
Diffstat (limited to 'pyfirstaidkit/utils/backup.py')
-rw-r--r-- | pyfirstaidkit/utils/backup.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pyfirstaidkit/utils/backup.py b/pyfirstaidkit/utils/backup.py index 79e4b85..4328163 100644 --- a/pyfirstaidkit/utils/backup.py +++ b/pyfirstaidkit/utils/backup.py @@ -184,9 +184,6 @@ class FileBackupStore(BackupStoreInterface): self.delete(name) os.rmdir(self._path) return True - - def cleanup_persistent(self): - return False def exists(self, name=None, path=None): if name == None and path == None: @@ -210,6 +207,10 @@ class FileBackupStore(BackupStoreInterface): return False + class BackupPersistent(Backup): + def cleanup(self): + return False + def __init__(self, rootpath = "/tmp", fullpath = ""): if self.__class__._singleton: raise BackupException("BackupStore with %s type can have only " @@ -237,9 +238,10 @@ class FileBackupStore(BackupStoreInterface): def getBackup(self, id, persistent = False): if not self._backups.has_key(id): - self._backups[id] = self.Backup(id, self._path+"/"+id+"/") if persistent: - self._backups[id].cleanup = self._backups[id].cleanup_persistent + self._backups[id] = self.BackupPersistent(id, self._path+"/"+id+"/") + else: + self._backups[id] = self.Backup(id, self._path+"/"+id+"/") return self._backups[id] def closeBackup(self, id): |