1
0

Separate db from storage

- storage is content-agnostic
 - db and storage are passed to wallet contructor
This commit is contained in:
ThomasV
2020-02-05 15:13:37 +01:00
parent c61e5db6a9
commit e1ce3aace7
25 changed files with 421 additions and 421 deletions

View File

@@ -33,10 +33,10 @@ from .logging import Logger
class Contacts(dict, Logger):
def __init__(self, storage):
def __init__(self, db):
Logger.__init__(self)
self.storage = storage
d = self.storage.get('contacts', {})
self.db = db
d = self.db.get('contacts', {})
try:
self.update(d)
except:
@@ -49,7 +49,7 @@ class Contacts(dict, Logger):
self[n] = ('address', k)
def save(self):
self.storage.put('contacts', dict(self))
self.db.put('contacts', dict(self))
def import_file(self, path):
import_meta(path, self._validate, self.load_meta)