Save existing roster content when setting a new backend.

This commit is contained in:
Lance Stout 2012-03-05 11:12:13 -08:00
parent be7f07ad12
commit 7b51c6f5cc

View file

@ -137,14 +137,18 @@ class RosterItem(object):
self._db_state = {}
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.
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
if save:
self.save()
self.load()
def load(self):