diff options
-rw-r--r-- | sleekxmpp/roster/item.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sleekxmpp/roster/item.py b/sleekxmpp/roster/item.py index bd7bbbde..eb2f64b3 100644 --- a/sleekxmpp/roster/item.py +++ b/sleekxmpp/roster/item.py @@ -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): |