From cb2dbd89b83fb8b599ec3033a743286b0de89b99 Mon Sep 17 00:00:00 2001 From: Ryan McGreal Date: Tue, 9 Dec 2014 20:50:13 -0500 Subject: [PATCH] v 1.5.7 fixed github issue #29 - code was calling `get_unique_id` even when it was not needed --- README.markdown | 11 +++++++++-- dicttoxml.py | 18 ++++++++---------- dist/dict2xml-0.1.tar.gz | Bin 1364 -> 0 bytes dist/dict2xml-0.2.tar.gz | Bin 1569 -> 0 bytes dist/dict2xml-0.3.tar.gz | Bin 1569 -> 0 bytes dist/dict2xml-0.4.tar.gz | Bin 1854 -> 0 bytes setup.py | 2 +- 7 files changed, 18 insertions(+), 13 deletions(-) delete mode 100644 dist/dict2xml-0.1.tar.gz delete mode 100644 dist/dict2xml-0.2.tar.gz delete mode 100644 dist/dict2xml-0.3.tar.gz delete mode 100644 dist/dict2xml-0.4.tar.gz diff --git a/README.markdown b/README.markdown index e5132e1..de000b2 100644 --- a/README.markdown +++ b/README.markdown @@ -233,12 +233,19 @@ Author Version ======= -* Version: 1.5.6 -* Release Date: 2014-08-18 +* Version: 1.5.7 +* Release Date: 2014-12-09 Revision History ================ +Version 1.5.7 +------------- + +* Release Date: 2014-12-09 +* Changes: + * Fixed [issue #29](https://github.com/quandyfactory/dicttoxml/issues/24) + Version 1.5.6 ------------- diff --git a/dicttoxml.py b/dicttoxml.py index 6338ac5..129f779 100755 --- a/dicttoxml.py +++ b/dicttoxml.py @@ -7,7 +7,7 @@ from __future__ import unicode_literals -__version__ = '1.5.6' +__version__ = '1.5.7' version = __version__ from random import randint @@ -136,11 +136,8 @@ def convert_dict(obj, ids, parent, attr_type): for key, val in obj.items(): logging.info('Looping inside convert_dict(): key="%s", val="%s", type(val)="%s"' % (key, val, type(val).__name__)) - if not ids: - attr = {} - else: - attr = {'id': '%s' % get_unique_id(parent)} - + attr = {} if not ids else {'id': '%s' % (get_unique_id(parent)) } + key, attr = make_valid_xml_name(key, attr) if type(val) in (int, float, long, str, unicode): @@ -175,12 +172,13 @@ def convert_list(items, ids, parent, attr_type): logging.info('Inside convert_list()') output = [] addline = output.append - this_id = get_unique_id(parent) + + if ids: + this_id = get_unique_id(parent) + for i, item in enumerate(items): logging.info('Looping inside convert_list(): item="%s", type="%s"' % (item, type(item).__name__)) - attr = {} if ids == False else { - 'id': '%s_%s' % (this_id, i+1) - } + attr = {} if not ids else { 'id': '%s_%s' % (this_id, i+1) } if type(item) in (int, float, long, str, unicode): addline(convert_kv('item', item, attr_type, attr)) elif hasattr(item, 'isoformat'): # datetime diff --git a/dist/dict2xml-0.1.tar.gz b/dist/dict2xml-0.1.tar.gz deleted file mode 100644 index ec92dd290d4762e9eccea6c983fc35c6ffc8b13c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1364 zcmV-a1*`fWiwFpKB_B@$|72-%bT4FSV{|fjZEP(tE-@~2VR8WNSZ#0HHW1Ed{feuL zz|vq#wrkggk)#{iH7nY@pfB5ip-5?qw$)IgN>Wbs?{`N@era8|36@|1bYCQs$LDzW z+#M;0(Zuw=#G>8tyTRV=NC#y&9MH2n9CX&7mF#u9!_M$=uQwRtc=u6fFxZ2^-W^D$ z4O0MnDrd3)BG0rfBd-rUH%8d?vnrhpojeTX$U$s|F8ja0tyRX__rNyx>YlGNBpFqH-|gdZMD# zloQWnf@($sLlhG&IGpEZj&p>CI!xsdB}M{E;O~>yppA->nO}mj40RRZyg?e^WOA%H z6C0BkJZ6y~6=Lew&lyX?e99(9svO;lOJxyFcw(J6K79|z_^z0M^K6V0@R}wkyaj)j z9`(vqnX<@pV^Tc|f>~td*_cp+4LiYCfl2d=ScaM48dv|b3fl+AbN-L@U;X%xTfh(c ze}B*)6!kyA?%(fX{SWY0UH^9>4<7`XR>3$*0-h`|W2q>ehcJ;L*53#+Gi^U{oJOPJ z+^~efaejffSxP-cLu7aiE~>R)DkQ_lSW3ZJ(kk^mTppr%A-F{aS73LtgJj2pkQoLh zPqC=3unvK#aby%3Pq;RS08?xgX3p0@v`?FOmMO&(BXUsua~3H?FmqW+g5tf@wU%CB*vPI1Ikh}#G&2RxCi8+ea$jiV zcb%Rk9R*Ri#?sWXn_6xK5pAd~4#NP@=2IJFgsY-)K-1L*i}%$ApUE^=(QIy@*Xj0P zoWuHAfNAyybr}(tB_S^|;HP^02o9*RV_(0zy7Fg9=1VmT>_MTq4x|X%%OA5;w0nNX zpPN`5*{X0tKE-(0(zqbkUCbhHWcxqPuN94DXiI?*3TeyCq?w_U;zMz+g`tS-SyjyV z6tN_(S&^UgiFvBi)KvOPWADUKeKr6ibs05l#|C5Xo zw;;mXB;78u1e9UDE|EoXB}L7BOCb&4ki}+EQO%ac-Wsj~{pTsY4&*L=Eeg?4z!4D} z1Q+N#;dgPo1AfVucMX!OlGsw%39NVlq!XFhDD$#~Rb^gT+meP0O1w?Gt1{ZwQp&UQ zhURdinC!lgS6sQ?%J%Ze`(7t2ZVANal9JYtEHA&YN@4`T574KmRf45 WrIuQ1sil^CFaH7`C+M62C;$KiIGUUQ diff --git a/dist/dict2xml-0.2.tar.gz b/dist/dict2xml-0.2.tar.gz deleted file mode 100644 index 4a26cde0bee9cfeb3603057272c03c3d89aa8e13..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1569 zcmV++2HyD}iwFoXNFPrE|72-%bT4FSV{|fjZEP(tE;253VR8WNSZ#0HHW1Ed{feuL zz;Wbs?{`N^mhHMu+OzHBTxt%WL@eZR4Aq=8)rJ{faH)I|(G0RE8}zuE zNI%xu#8VOBGOd6iiuM;AE>bU~|gzddkcYenD&mX>X z3%I5K_xpoEUjGM!ei!S%-))!me=qXzK`T+RHTI(xj~2*SDoW=eOoWH^H-tn_n~xo* zQmHuKSi;~qkKj!bQ%_OgYaT)kmo;D-2!@xj5J7_$Hz0|8)XVFL;GqRUzzs0e0&Gxb zkW|&dW14|ZW2~ziEJa{)>}yH-Bd#tGqO>V46hMDxV@j<1U;>cpEUyW!?-Ma9#}ph@}{_u~E11 zl~0QBH3SXWH8xreAvN3?wIS?3HSS`(Qjx#}V@Nij1%yoQqelWwk%jkl*f)~JXd{|IE|8^g%~RFl0S_?<%0zU*f`n&!u8t@MC*Zm+9JS2-6=bW8 zu2VFEj8Pz_CY1^mO@Xt?+-8&HcKG=k)p#)Q=`X;&GxR)5ynhqPgXa2}xm?W#K9>Eq&`QjD+UHoSOyo zjB5&+U3OJqp%qU>oJxN-*U)Wux-d>*b=#tfc#SZO7?wmHw^Y5;el!Gdj%XXgUFhcK z#+^lpE99(Ywl&37O9WnX`7n!vX4h@Ia~%dJriMK}PG-0nonn@_gO5{)g!ZRt?GckR zRUevt3s+vCSLmc&??+fqA){mx2ra>^XIL575Gk$`8JSrsKg2VsLs*Myc0_`uv225+ zN5|SRvF+uOxKYD0ENoe6Jch(unoMq%NOYWN+HK$4vw`OYzS-~Xj7yY?yrq%X4Oozs zsLwTguGI@;v&hhzhDmL0QLis&F#_2b0n|3AQ#7*zZ^fWm?(Ox$;IH8FU4^*q}2jNFGo3Hu? zIm}xoQCsO@8s&GShwW*RZFQd!gGMuA(Crp(nBjj(k1Byw8?d3G$bwaJcc$DOa2IJz z>!sY98!nN@Vkh!1AfVY`Yp^^B~D&vTUZmVw0+uTEoatflr{aFM!7;K@m* zqIk`mkSKKK=JOgLKX-HV=lcG;cz)JAADzCs=l?&wgYL%vzg`EY%kRH?ke6IDI=VKq zBjym0{muxx({Nes&TDP04M+e+DZ*F diff --git a/dist/dict2xml-0.3.tar.gz b/dist/dict2xml-0.3.tar.gz deleted file mode 100644 index 023149ac5537dee64cddab7fd726ac70a35fbc1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1569 zcmV++2HyD}iwFqQS07IT|72-%bT4FSV{|fjZEP(tE;BB4VR8WNSZ#0HHW2n_{feuL zKz3ovZ?Rn%NxGq3vY@RS^ko|`6bWt7wi-!PNy@4I{q88qvR&6nyEfQxW1at$-nl_Ldwj61~7V!ooF7Cg6oy01M%-moGqR>4kGA17k6+m4x#e(*Q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2wc4JBwUs_t-)LyUG4U-5+olXU%I6QOi6SgRGHu(tumjbqi=4AMNh{n3c7T1KN#QDzPCAe{~RJ+-DaxAaE&NyS*+u(a8#)F|Fi zs8)IALS^_4U%$30W6!e1amuKK`s~!Bg#R-NBf84m_#nec#){z;yIF z%O75~zrT3-<`dul_fL8o-+%hO{>kC}|5LQrOo#N+*v@a`0>CWfTwq}d%53PAV@ML` z$852{SMvZKcpu<=Cl{=pgmc_s@5?ynD{}!EK>cnq?`)e}$pE(BNjm5DHZp*{?joIU z^83Q}`?u%!5OBwBAsTJ-y3qNi`fw4zU-P3yQ8dbjzuHHPZ2~@;j~ZKqe+(Zvwut>0 sKYEmET*jfMi@^ZiU;J?K=06vQ)6StC+MylVq5TuuALM>3kN_wE05=q>qW}N^ diff --git a/setup.py b/setup.py index 9544cca..3f18706 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from distutils.core import setup -version = '1.5.6' +version = '1.5.7' with open('README.markdown') as readme: long_description = readme.read()