rit*_*vik 6 python django jquery typeerror
在运行程序时,我收到以下错误消息
Caught TypeError while rendering: __init__() got an unexpected keyword
argument 'use_decimal'
Run Code Online (Sandbox Code Playgroud)
这是我使用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)
Run Code Online (Sandbox Code Playgroud)
的签名simplejson.dumps是(参见文档):
dumps(obj, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, cls=None)
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,没有use_decimal参数......但你是这样调用它的:
simplejson.dumps(chart_list, use_decimal=True)
Run Code Online (Sandbox Code Playgroud)
编辑:实际上,更多的挖掘带来了其他文档。似乎该use_decimal参数是在 simplejson 库的版本中的某个位置添加的...我建议将您的库版本升级到最新的可用版本!
| 归档时间: |
|
| 查看次数: |
6033 次 |
| 最近记录: |