运行程序时我收到以下错误消息
Caught TypeError while rendering: __init__() got an unexpected keyword
argument 'use_decimal'
这是我的代码
我正在使用 jquery 1.6.4
def load_charts(chart_list=None, render_to=''):
embed_script = (
'<script type="text/javascript">\n'
'var _chartit_hco_array = %s;\n</script>\n'
'<script src="%s" type="text/javascript">\n</script>')
if chart_list is not None:
if isinstance(chart_list, (Chart, PivotChart)):
chart_list = [chart_list]
chart_list = [c.hcoptions for c in chart_list]
render_to_list = [s.strip() for s in render_to.split(',')]
for hco, render_to in izip_longest(chart_list, render_to_list):
if render_to:
hco['chart']['renderTo'] = render_to
embed_script = (embed_script % (simplejson.dumps(chart_list,
use_decimal=True),
CHART_LOADER_URL))
else:
embed_script = embed_script %((), CHART_LOADER_URL)
return mark_safe(embed_script)
的签名simplejson.dumps
是(参见文档 http://svn.red-bean.com/bob/simplejson/tags/simplejson-1.3/docs/module-simplejson.html#dumps):
dumps(obj, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, cls=None)
如你所见,没有use_decimal
参数...但你这样称呼它:
simplejson.dumps(chart_list, use_decimal=True)
EDIT:实际上提出了更多的挖掘其他文档 http://simplejson.googlecode.com/svn/tags/simplejson-2.1.0/docs/index.html。看来use_decimal
参数已添加到 simplejson 库版本的某处...我建议将您的库版本升级到最新的可用版本!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)