Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 02-01-2011, 03:28 PM   #1
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Removal of plugin not removing config store

It appears that when you remove a plugin it doesn't remove the configuration store information.

In my plugin I run plugin_store = JSONConfig('plugins/somename') and c = config_store().get(storename, storedefaults) along with c.get and c.set. Data saves and loads ok.

However, if I remove the plugin either by the GUI or cli, when I re-add my plugin and start it, the last values saved in the store are visible to the plugin. Because I stored some incorrect data one time, this caused some problems in plugin development. Although I was able to get around it by saving an empty data set to the store before continuing.

I expected the plugin removal to remove any stored information for the plugin. Is it leaving the information just in case, or is it a bug?

Is there a way to manually remove the store (in order to give instructions for a complete removal)?
meme is offline   Reply With Quote
Old 02-01-2011, 03:34 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Since plugins can execute arbitrary code, there is no way to reliably remove their stored config information. You should add error handlers in your plugin to deal with malformed persistent data.
kovidgoyal is offline   Reply With Quote
Old 02-01-2011, 03:42 PM   #3
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Okay, thanks. I was thinking of adding a version number to the store as well, but it still needs to handle errors. Though I may ending up having to save to an external file anyway to allow some more flexibility in what I'm doing.

By the way for Calibre! Its proving not only great to use but also great to develop with
meme is offline   Reply With Quote
Old 02-01-2011, 04:34 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Cool. my development goal with calibre is to try and always optimize for maintainability.
kovidgoyal is offline   Reply With Quote
Old 02-01-2011, 04:45 PM   #5
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
I had been wondering about asking Kovid if he would be interested in offering an optional "def uninstall(self)" function or similar as part of the plugin API, giving plugins an opportunity to implement their own cleanup. As he said above there is no way Calibre can "automatically" do anything as we have such freedom to do what we like within a plugin... mwah hah haaa...

Why I hadn't as yet at least asked was that it is possible that users seeing a new version of a plugin erroneously think that they need to uninstall the old one first. That would of course make them lose all their settings.

Either way the issue can be resolved if with sufficient documentation if the users will read it - such as telling them to go to the config plugins directory and delete the .JSON file if it bothers them.
kiwidude is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DRM removal plugin for Calibre cococrou Plugins 63 11-01-2012 05:08 PM
Create area for plugin images in config directory DoctorOhh Plugins 19 12-15-2010 12:28 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM
Statusbar config? tselling PocketBook 0 11-13-2009 10:47 AM
Removing DRM from Sony Store books thibaulthalpern Sony Reader 10 03-11-2009 01:17 AM


All times are GMT -4. The time now is 06:11 PM.


MobileRead.com is a privately owned, operated and funded community.