Changeset fc3a16d5ddf5…
Parent 2a0b937c89e4…
by
Changes to one file · Browse files at fc3a16d5ddf5 Showing diff from parent 2a0b937c89e4 Diff from another changeset...
@@ -8,6 +8,7 @@ """
import dumbdbm, anydbm
+saved_default = anydbm._defaultmod
anydbm._defaultmod = dumbdbm
import os
@@ -86,7 +87,18 @@
def read(self):
self._data.clear()
- if not os.path.exists(self._path):
+ if os.path.exists(self._path):
+ # One-time import of <=0.7 config file
+ anydbm._defaultmod = saved_default
+ dbase = shelve.open(self._path)
+ self._dbappname = dbase['APPNAME']
+ self.version = dbase['VERSION']
+ self._data.update(dbase.get('DATA', {}))
+ dbase.close()
+ anydbm._defaultmod = dumbdbm
+ os.unlink(self._path)
+ return
+ if not os.path.exists(self._path+'.dat'):
return
dbase = shelve.open(self._path)
|
Loading...