AUDIT: r15205 - gnucash/trunk - Load and store a commodity's KVP-frame (IFF it's non-empty).

Chris Shoemaker c.shoemaker at cox.net
Mon Dec 11 22:39:46 EST 2006


On Mon, Dec 11, 2006 at 09:51:37PM -0500, Derek Atkins wrote:
> Author: warlord
> Date: 2006-12-11 21:51:37 -0500 (Mon, 11 Dec 2006)
> New Revision: 15205
> Trac: http://svn.gnucash.org/trac/changeset/15205
> 
> Modified:
>    gnucash/trunk/
>    gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
> Log:
> Load and store a commodity's KVP-frame (IFF it's non-empty).
> This would let us store something like an Asset Class.
> BP

I don't think this should be back-ported.  At least not the whole
thing.  I don't mind backporting the first and last hunks, but I'm
against breaking backward compatibility of the datafile within a
stable branch.  

In fact, even between major releases I think these types of changes
should only be made if there's enough of them to warrant it.

Also, I'd prefer to see the proposed feature implemented _before_
breaking compatibilty, not the other way around.

Now, if someone wanted to make it so that our xml reader didn't croak
on unrecognized tags, that would make this kind of change easier.

So, can we please comment out hunks 2 and 3 with a comment about
re-enabling them when we're willing to break backward compatibility?

-chris

> Property changes on: gnucash/trunk
> ___________________________________________________________________
> Name: svk:merge
>    - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
> 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
> d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13679
> d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
>    + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
> 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
> d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13699
> d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
> 
> Modified: gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
> ===================================================================
> --- gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-12-11 22:28:36 UTC (rev 15204)
> +++ gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-12-12 02:51:37 UTC (rev 15205)
> @@ -58,6 +58,7 @@
>  #define cmdty_get_quotes     "cmdty:get_quotes"
>  #define cmdty_quote_source   "cmdty:quote_source"
>  #define cmdty_quote_tz       "cmdty:quote_tz"
> +#define cmdty_slots          "cmdty:slots"
>  
>  xmlNodePtr
>  gnc_commodity_dom_tree_create(const gnc_commodity *com)
> @@ -66,8 +67,11 @@
>      const char *string;
>      xmlNodePtr ret;
>      gboolean currency = gnc_commodity_is_iso(com);
> +    xmlNodePtr kvpnode =
> +      kvp_frame_to_dom_tree(cmdty_slots,
> +			    qof_instance_get_slots(QOF_INSTANCE(com)));
>  
> -    if (currency && !gnc_commodity_get_quote_flag(com))
> +    if (currency && !gnc_commodity_get_quote_flag(com) && !kvpnode)
>        return NULL;
>  
>      ret = xmlNewNode(NULL, BAD_CAST gnc_commodity_string);
> @@ -108,6 +112,10 @@
>        if (string)
>  	xmlAddChild(ret, text_to_dom_tree(cmdty_quote_tz, string));
>      }
> +
> +    if (kvpnode)
> +      xmlAddChild(ret, kvpnode);
> +
>      return ret;
>  }
>  
> @@ -159,6 +167,12 @@
>  	gnc_commodity_set_quote_source(com, source);
>          xmlFree (string);
>      }
> +    else if(safe_strcmp((char*)node->name, cmdty_slots) == 0)
> +    {
> +      /* We ignore the results here */
> +      dom_tree_to_kvp_frame_given(node,
> +				  qof_instance_get_slots(QOF_INSTANCE(com)));
> +    }
>      else 
>      {
>          struct com_char_handler *mark;
> 
> _______________________________________________
> gnucash-changes mailing list
> gnucash-changes at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-changes


More information about the gnucash-devel mailing list