r18376 - gnucash/trunk/src/backend/xml - Partly fix broken data file backward compatibility where SX recurrence would disappear.

Christian Stimming stimming at tuhh.de
Thu Oct 8 10:41:58 EDT 2009


Zitat von Derek Atkins <warlord at MIT.EDU>:
> How about also putting it into the KVP?  This way it would
> survive a 2.2.x read/save.

Yes, I though of that, too.  First I though SX don't have a kvp slot  
anyway, but apparently SchedXaction.h says there is a  
xaccSchedXactionGetSlot(). However, it's the complete Recurrence  
object that won't be loaded by 2.2.x if there is a  
<recurrence:weekend_adj> child element. Hence, if KVP should be used  
to store the recurrence data as a backup, we would have to store the  
complete content of the struct Recurrence (defined in Recurrence.h).  
Alternatively the weekend_adj content wouldn't be stored as a child  
element at all but it would always be stored as a KVP in the parent  
SX. However, in that case I don't know where to place the code to 1.  
write the weekend_adj data in the the KVP on savind and 2. read the  
data from the KVP on reading and write it into the actual Recurrence  
object at the correct time. So basically this solution was all that I  
knew about the reading/writing code.

>  Obviously if it's none you can
> just leave it blank, but if it's NOT "none" then store it
> in the KVP..  on READ look both for the XML and the KVP
> (where the XML tag takes precedence over the KVP, but the KVP
> is a backup just in case you're loading in from 2.2.x)
>
> Then in 2.5/2.6/3.0 we can turn off the KVP and turn on the
> XML tag.
>
> I believe Phil did this with some other tags recently; I think
> it's the better way to approach the problem.

Yes, but in Phil's recent case the data was belonging to an object  
which already had a KVP, where here, we are dealing with the  
Recurrence object which doesn't have KVP.

Regards,

Christian




> -derek
>
> Christian Stimming <cstim at code.gnucash.org> writes:
>
>> Modified:
>>    gnucash/trunk/src/backend/xml/gnc-recurrence-xml-v2.c
>> Log:
>> Partly fix broken data file backward compatibility where SX  
>> recurrence would disappear.
>>
>> In r17725 and r17751, I introduced the extra XML child element
>> <recurrence:weekend_adj>, but this means a gnucash-2.2.x cannot read
>> the SX recurrence of a >=2.3.x file anymore, which is bad. In order
>> to improve this broken backward compatibility for at least the common
>> case, we don't write out this XML element as long as it is only "none".
>
> --
>        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
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>





More information about the gnucash-devel mailing list