summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-10-24 14:25:57 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-10-24 15:02:40 +0200
commite0abf47477f0f3681c6cf0b28f66fb1833d32a17 (patch)
tree3e03423e872ee7267b04793722cacab14bd20964 /pyfirstaidkit
parent0e97e5cf3ea3dcc7aef434f358394127b02575d2 (diff)
downloadfirstaidkit-e0abf47477f0f3681c6cf0b28f66fb1833d32a17.tar.gz
firstaidkit-e0abf47477f0f3681c6cf0b28f66fb1833d32a17.tar.xz
firstaidkit-e0abf47477f0f3681c6cf0b28f66fb1833d32a17.zip
backup.py
Put the reverting logic into the main Backup class. This will allow future classes that inherit from Backup to have this attribute.
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/utils/backup.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/pyfirstaidkit/utils/backup.py b/pyfirstaidkit/utils/backup.py
index be086fb..2a11283 100644
--- a/pyfirstaidkit/utils/backup.py
+++ b/pyfirstaidkit/utils/backup.py
@@ -72,13 +72,14 @@ class FileBackupStore(BackupStoreInterface):
_singleton = None
class Backup(BackupStoreInterface.Backup):
- def __init__(self, id, path):
+ def __init__(self, id, path, reverting = False):
self._id = id
self._path = path
self._metafile = "__meta.pickle"
self._data = {} # name -> (stored as, origin)
self._origin = {} # origin -> name
- os.makedirs(self._path)
+ if not reverting:
+ os.makedirs(self._path)
def saveMeta(self):
f = open(os.path.join(self._path, self._metafile), "wb")
@@ -238,16 +239,6 @@ class FileBackupStore(BackupStoreInterface):
return False
class BackupPersistent(Backup):
- def __init__(self, id, path, reverting = False):
- self._id = id
- self._path = path
- self._metafile = "__meta.pickle"
- self._data = {} # name -> (stored as, origin)
- self._origin = {} # origin -> name
-
- if not reverting:
- os.makedirs(self._path)
-
def cleanup(self):
self.saveMeta()
return False