diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-05 11:12:13 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-03-05 11:12:13 -0800 |
commit | 7b51c6f5ccfbd7937184b49ddbfeae927c8a3248 (patch) | |
tree | 2af62135107f7f07cf089ace83c58caea0a1a60b /sleekxmpp/roster/item.py | |
parent | be7f07ad1231b30bf953f0761773af46db952c62 (diff) | |
download | slixmpp-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/item.py')
-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): |