r15486 - gnucash/trunk/src - SX "enabled" patch from Peter McAlpine <peter at aoeu.ca>.

Derek Atkins warlord at MIT.EDU
Thu Feb 1 11:58:57 EST 2007


Quoting Josh Sled <jsled at asynchronous.org>:

> On Thu, 2007-02-01 at 09:50 -0500, Derek Atkins wrote:
>> Why not store the sx:enabled flag in the SX instance KVP?  Granted, I
>> dont think 2.0 has an SX KVP, but we could maybe fix that...
>
> Besides the fact -- as you point out -- that it doesn't solve the
> problem, KVP frames aren't actually data model.  I maintain that we
> should try not to use them, and if we do, only with good reason; this
> doesn't feel like one.

Well, ideally in the future we could create an XML <-> GObject-properties
mapping so that we could always load (and save) any data object.  But this
is a longer-term "thing".

>> I'll
>> point out that the 2.0 parser will barf on unknown tags and fail
>> to load the data file.
>
> Yup; as I mentioned on -devel, it might be a good thing to fix for a
> 2.0.{5,6}, so we get a bit of breathing room for 2.{x>0}...
>
> To preempt your question about "how do you tell a broken datafile from
> one with simply new tags?", I say: "you don't".  You let XML
> well-formed-ness deal with really corrupted datafiles, and you ignore
> any tags or attributes that you don't recognize.   If you then ignore
> valid future data, fine; if you ignore invalid/broken data, fine.  The
> utility of reading a wider set of datafiles is higher than the risk of
> reading inconsistent data, with some amount of care taken in the future.

I still maintain that loading-and-ignoring is WORSE than failing-to-load.
When you load-and-ignore, then when you save you've now LOST data, and
worse, you've lost it silently!  I think that's worse than just failing to
load the datafile.

Ideally, EVERYTHING would be "like" a KVP-frame..  But using Gobject
properties and GValue (or perhaps GNCValue, so we can define our own
GValue types)...  Then we always load (and save) all properties, and
hopefully don't have to know a-prori all the properties we might want
(or need) to save.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list