Backwards compatibility with new currency issue and bug 336843.

Frédéric Perrin fred at fperrin.net
Tue Nov 19 17:47:02 EST 2013


Le mardi 19 à 23:38, Frédéric Perrin a écrit :
> Le mardi 19 à 23:05, Derek Atkins a écrit :
>> On Tue, November 19, 2013 4:58 pm, Frédéric Perrin wrote:
>> I would recommend we do something slightly different.  I would have TWO
>> setter functions, a "set_default()" as well as a "set()".  The
>> gnc_commodity object can be extended to cache the value.  The
>> set_default() would only set the cached value.  The set() function would
>> both set the cached value *and* set the kvp.  The get() function could
>> first check the kvp() and, if that is empty or non-existing it can use the
>> cached value.  Either that, or at load time we cache the value from the
>> kvp if it exists and then get() only needs to read the cached value.
>
> That would also limit the modifications to the commodity class, rather
> tham having each backend checking whether the commodity is used.
>
> The attached patch compiles and seems to do what we want from 5 minutes
> of testing.

That won't fix files that have been edited between the addition of the
new currency and the installation of this patch. Do we care ?

-- 
Fred



More information about the gnucash-devel mailing list