summaryrefslogtreecommitdiff
path: root/sleekxmpp/roster
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-05 11:12:13 -0800
committerLance Stout <lancestout@gmail.com>2012-03-05 11:12:13 -0800
commit7b51c6f5ccfbd7937184b49ddbfeae927c8a3248 (patch)
tree2af62135107f7f07cf089ace83c58caea0a1a60b /sleekxmpp/roster
parentbe7f07ad1231b30bf953f0761773af46db952c62 (diff)
downloadslixmpp-7b51c6f5ccfbd7937184b49ddbfeae927c8a3248.tar.gz
slixmpp-7b51c6f5ccfbd7937184b49ddbfeae927c8a3248.tar.bz2
slixmpp-7b51c6f5ccfbd7937184b49ddbfeae927c8a3248.tar.xz
slixmpp-7b51c6f5ccfbd7937184b49ddbfeae927c8a3248.zip
Save existing roster content when setting a new backend.
Diffstat (limited to 'sleekxmpp/roster')
-rw-r--r--sleekxmpp/roster/item.py8
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):