fritzy/SleekXMPP — Issue #117: External DB backend for roster
Author: coffeeowl
Created: 2011-11-25 11:37:24+00:00
State: open

I am trying to attach Mongo DB I already have to Roster. RosterItem says I have to implement two methods - load and save. Looks like it is not enough, because Roster.set_backend tries to access 'entries' on my class.

def set_backend(self, db=None):
"""
Set the datastore interface object for the roster.

Arguments:
db -- The new datastore interface.
"""
self.db = db
for node in self.db.entries(None, {}):
self.add(node)
for node in self._rosters:
self._rosters[node].set_backend(db)

Also, what will happen if I invoke this method with default arg for 'db'? I think it will fail, as None can't have 'entries' property.