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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-24-2011, 04:38 AM   #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
JSONConfig has no delete method

JSONConfig in utils/config.py allows set/get but not delete of a specific key. Is it possible to delete a key from a plugin's json file?

Normally I don't need this, but I'm renaming a key and the only way I found to 'remove' the old key is to set the old key value to Null.

This is sufficient, although it leaves old/unused data in the file, and it means an extra test is needed since the key exists but the data is Null (since get(store_name, DEFAULTS) will not set the key to DEFAULTS if the key exists but is a dict with Null).
meme is offline   Reply With Quote
Old 02-24-2011, 07:21 AM   #2
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,898
Karma: 1216548
Join Date: Jan 2010
Location: France
Device: Many android devices
JSONConfig inherits from XMLConfig, which does have a delete operation. Have you tried using "del json_object[key]"?
chaley is offline   Reply With Quote
 
Advertisement
Old 02-24-2011, 09:38 AM   #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
That was it, thanks. I've used the del statement elsewhere, and noticed that XMLConfig inherits from dict, but didn't connect using del on it would work like del for a dict. The del statement is a bit odd anyway since most everything else is called like a function - I was looking for a del() method and all I could see was __delitem__ (which given the __ I believe is an internal method).
meme 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
Method for seeing only the recent imports peterloron Calibre 3 09-22-2010 05:02 PM
"cannot import name JSONConfig" on launching calibre .42 hakan42 Calibre 4 02-27-2010 04:37 AM
Delete files in PC not equal to delete in Sony reader 505 sheilalayoli Sony Reader 5 07-12-2009 04:13 PM
Library management - your method? thfc2008 Sony Reader 1 10-28-2008 11:24 AM
alternate login method? curtw Feedback 9 04-24-2008 12:05 AM


All times are GMT -4. The time now is 07:05 AM.


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