Rework options/optionhandler to use custom save/load functions

This commit is contained in:
Griatch 2019-04-14 20:29:21 +02:00
parent f2d9391827
commit 10b3657ffb
3 changed files with 128 additions and 93 deletions

View file

@ -200,7 +200,12 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
@lazy_property
def options(self):
return OptionHandler(self, options_dict=settings.OPTIONS_ACCOUNT_DEFAULT, save_category='option')
return OptionHandler(self,
options_dict=settings.OPTIONS_ACCOUNT_DEFAULT,
savefunc=self.attributes.add,
loadfunc=self.attributes.get,
save_kwargs={"category": 'option'},
load_kwargs={"category": 'option'})
# Do not make this a lazy property; the web UI will not refresh it!
@property