#2349: Jsonifcation of valid XML data fails
-----------------------+----------------------------------------------------
Reporter: kvdb | Owner: chrisz
Type: defect | Status: new
Priority: normal | Milestone:
Component: TurboJson | Version: 1.1 HEAD
Severity: normal | Keywords:
-----------------------+----------------------------------------------------
Not sure which component to file this bug under.
But for some API call, TGWS outputs this XML:
<result>
<latitude/>
<longitude/>
</result>
The same output but then requested as JSON format returns the stacktrace
below.
They problem is in the None types that are rendered in XML as
<longitude/>. When I replace None with an empty string, JSON does render
correctly.
I suspect this is a bug and that None should be handled by the jsonify
code.
TurboGears-1.1b3dev_r6583-py2.6.egg/turbogears/controllers.py\", line 96,
in _process_output\n fragment=fragment)\n\n
File \"/home/kvdb/public/6pp/env/sevenpp_tg1.1_r6583/lib/python2.6/site-
packages/TurboGears-1.1b3dev_r6583-py2.6.egg/turbogears/view/base.py\",
line 194, in render
return engine.render(**kw)
File \"build/bdist.linux-i686/egg/turbojson/jsonsupport.py\", line 40, in
render
output = self.encoder.encode(info)
File \"build/bdist.linux-i686/egg/simplejson/encoder.py\", line 200, in
encode
chunks = self.iterencode(o, _one_shot=True)
File \"build/bdist.linux-i686/egg/simplejson/encoder.py\", line 260, in
iterencode
return _iterencode(o, 0)
File \"build/bdist.linux-i686/egg/turbojson/jsonify.py\", line 163, in
default
return jsonify(obj)
File \"<generated code>\", line 0, in jsonify
File \"build/bdist.linux-i686/egg/peak/rules/core.py\", line 214, in
__call__
raise self.__class__(*self.args+(args,kw)) # XXX\n\nNoApplicableMethods:
((<api.apiobjects.APIStreet object at 0x9c02cac>,), {}, <bound method
ServicesRoot.get_street of <api.controllers.ServicesRoot object at
0xb7ed5acc>>)\n\n", "faultcode": "Server", "faultstring":
"((<api.apiobjects.APIStreet object at 0x9c02cac>,), {}, <bound method
ServicesRoot.get_street of <api.controllers.ServicesRoot object at
0xb7ed5acc>>)"}
--
Ticket URL: <http://trac.turbogears.org/ticket/2349>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---