← Back to team overview

ubuntu-phone team mailing list archive

Re: Preferred Settings API for Ubuntu apps

 

On ĵaŭ, 2014-07-31 at 17:44 +0200, Christian Dywan wrote:
> From my point of view once you start dealing with objects you'll want
> U1db* and for instance save your object as a document.
> 
> Do you have a specific example?

My app is a dictionary, and it contains translations for many languages.
I want to only display relevant languages to the user. For this, I use
an Object as a simple key/value store, with the key being the language
and the value a boolean as to whether it should be shown or not.

I'd prefer the keys to not be hardcoded, as I load all the data
(including the list of languages) from downloaded data, so if a new
language were to be added to the list, then the app would check at the
beginning and see it missing from the saved Object and add a value for
it.

Essentially, all I want is a simple Python dictionary.

Although, having just explained all this, I've just realised a possibly
better solution would be to simply store an array of enabled languages,
and check if a language is in the array. Though, this would still be
better if the values were hashed, are there sets in Javascript, and
could they be saved?

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References