diff options
Diffstat (limited to 'ipsilon/util')
-rwxr-xr-x | ipsilon/util/data.py | 11 | ||||
-rwxr-xr-x | ipsilon/util/user.py | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 78fa5ab..5672d04 100755 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -317,7 +317,16 @@ class UserStore(Store): super(UserStore, self).__init__('user.prefs.db') def save_user_preferences(self, user, options): - return self.save_options('users', user, options) + self.save_options('users', user, options) + + def load_user_preferences(self, user): + return self.load_options('users', user) + + def save_plugin_data(self, plugin, user, options): + self.save_options(plugin+"_data", user, options) + + def load_plugin_data(self, plugin, user): + return self.load_options(plugin+"_data", user) class TranStore(Store): diff --git a/ipsilon/util/user.py b/ipsilon/util/user.py index 47cb23c..3a4962d 100755 --- a/ipsilon/util/user.py +++ b/ipsilon/util/user.py @@ -40,7 +40,7 @@ class User(object): def _get_user_data(self, username): store = UserStore() - return store.load_options('users', username) + return store.load_user_preferences(username) def reset(self): self.name = None @@ -98,6 +98,14 @@ class User(object): # TODO: implement setting sites via the user object ? raise AttributeError + def save_plugin_data(self, plugin, data): + store = UserStore() + store.save_plugin_data(plugin, self.name, data) + + def load_plugin_data(self, plugin): + store = UserStore() + return store.load_plugin_data(plugin, self.name) + class UserSession(Log): def __init__(self): |