View Single Post
Old 02-21-2015, 02:21 AM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Kovid: Not, its the saving of the library configuration for the plugin. It looks to be due to https://github.com/kovidgoyal/calibr...486444441b2a3c and some not that good code in the plugins.

From a quick look, the plugins that save configuration in the library all have code that something looks like:

Code:
def get_library_config(db):
    library_config = None

    if library_config is None:
        library_config = db.prefs.get_namespaced(PREFS_NAMESPACE, PREFS_KEY_SETTINGS,
                                                 copy.deepcopy(DEFAULT_LIBRARY_VALUES))
    migrate_library_config_if_required(db, library_config)
    debug_print("get_library_config - library_config:", library_config)
    return library_config

def set_library_config(db, library_config):
    debug_print("set_library_config - library_config:", library_config)
    db.prefs.set_namespaced(PREFS_NAMESPACE, PREFS_KEY_SETTINGS, library_config)
And tracking through the code, "library_config" is changed directly and means the comparison added in the __set__ method will always return that there are no changes. Like I said, some "not that good code".

The fix is easy. The plugins should be taking a deep copy of the config and changing that. But, it needs to be done for all the plugins. I seem to have 10 plugins that do this, and there might be more.
davidfor is offline   Reply With Quote