Discussion:
[Generateds-users] Buggy code generated from 2.23a?
Lev Israel
2016-10-13 12:42:33 UTC
Permalink
Sorry - the corrected code should be:

self.value.export(outfile, level, namespace, name,
pretty_print=pretty_print)

The positional arguments were in the right order, it was only the absence
of a namespacedef_ and/or passing pretty_print as a positional argument
that was troublesome here.
The attached python file was generated from the attached XSD using version
2.23a.
I found that in trying to parse the attached XML (I apologize for the
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 2034, in exportChildren
item_.export(outfile, level, item_.name, namespace_,
pretty_print=pretty_print)
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 545, in export
self.value.export(outfile, level, namespace, name, pretty_print)
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 2123, in export
outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' +
namespacedef_ or '', ))
TypeError: cannot concatenate 'str' and 'bool' objects
In looking at the code, it looks like there's a signature mismatch in the
self.value.export(outfile, level, namespace, name,
pretty_print)
self.value.export(outfile, level, name, namespace,
pretty_print=pretty_print)
And the error seems to be solved.
Did I find a bug here, or am I lost in the weeds?
--
Lev Israel
Software Architect
SEFARIA <http://www.sefaria.org/>
+972-54-239-1852
Twitter <https://twitter.com/sefariaproject>
Facebook <http://www.facebook.com/sefaria.org>
--
Lev Israel
Software Architect
SEFARIA <http://www.sefaria.org/>
+972-54-239-1852

Twitter <https://twitter.com/sefariaproject>
Facebook <http://www.facebook.com/sefaria.org>
Dave Kuhlman
2016-10-13 22:44:22 UTC
Permalink
Post by Lev Israel
self.value.export(outfile, level, namespace, name,
pretty_print=pretty_print)
The positional arguments were in the right order, it was only the absence
of a namespacedef_ and/or passing pretty_print as a positional argument
that was troublesome here.
Lev,

Thanks for catching this bug. And, thank you for the fix.

I've patched your fix into my repo. And, I've re-run the unit tests
and brought them up-to-date.

I've attached a patch file containing this change. And, I pushed
this change to the Mercurial repository at Bitbucket:

https://bitbucket.org/dkuhlman/generateds

Thanks again.

Dave
Post by Lev Israel
The attached python file was generated from the attached XSD using version
2.23a.
I found that in trying to parse the attached XML (I apologize for the
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 2034, in exportChildren
item_.export(outfile, level, item_.name, namespace_,
pretty_print=pretty_print)
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 545, in export
self.value.export(outfile, level, namespace, name, pretty_print)
File "/Users/levisrael/sefaria/Sefaria-Data/sources/Mesechtot
Ketanot/DCXML.py", line 2123, in export
outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' +
namespacedef_ or '', ))
TypeError: cannot concatenate 'str' and 'bool' objects
In looking at the code, it looks like there's a signature mismatch in the
self.value.export(outfile, level, namespace, name, pretty_print)
self.value.export(outfile, level, name, namespace,
pretty_print=pretty_print)
And the error seems to be solved.
Did I find a bug here, or am I lost in the weeds?
--
Lev Israel
Software Architect
SEFARIA <http://www.sefaria.org/>
+972-54-239-1852
Twitter <https://twitter.com/sefariaproject>
Facebook <http://www.facebook.com/sefaria.org>
--
Lev Israel
Software Architect
SEFARIA <http://www.sefaria.org/>
+972-54-239-1852
Twitter <https://twitter.com/sefariaproject>
Facebook <http://www.facebook.com/sefaria.org>
--
Dave Kuhlman
http://www.davekuhlman.org
Loading...