Save existing roster content when setting a new backend.
This commit is contained in:
parent
be7f07ad12
commit
7b51c6f5cc
@ -137,14 +137,18 @@ class RosterItem(object):
|
|||||||
self._db_state = {}
|
self._db_state = {}
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def set_backend(self, db=None):
|
def set_backend(self, db=None, save=True):
|
||||||
"""
|
"""
|
||||||
Set the datastore interface object for the roster item.
|
Set the datastore interface object for the roster item.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
db -- The new datastore interface.
|
db -- The new datastore interface.
|
||||||
|
save -- If True, save the existing state to the new
|
||||||
|
backend datastore. Defaults to True.
|
||||||
"""
|
"""
|
||||||
self.db = db
|
self.db = db
|
||||||
|
if save:
|
||||||
|
self.save()
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user