Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Should use stdlib json in django 1.5+ #1517

Closed
craigds opened this Issue · 5 comments

5 participants

Craig de Stigter Patrick Lauber Iacopo Spalletti Charlie Denton Paulo
Craig de Stigter
In [6]: from cms.templatetags.cms_js_tags import *
js
In [7]: js('hi')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (3, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/cdestigter/<ipython console> in <module>()

/home/cdestigter/checkout/django-cms/cms/templatetags/cms_js_tags.pyc in js(value)
     10 @register.filter
     11 def js(value):
---> 12     return simplejson.dumps(value, cls=DjangoJSONEncoder)
     13 
     14 @register.filter

/usr/lib/pymodules/python2.6/simplejson/__init__.pyc in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, encoding, default, use_decimal, **kw)
    267         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    268         separators=separators, encoding=encoding, default=default,
--> 269         use_decimal=use_decimal, **kw).encode(obj)
    270 
    271 

TypeError: __init__() got an unexpected keyword argument 'use_decimal'

This occurs with python 2.6 (json.__version__ == '1.9') and simplejson 2.1.6 installed.
In django 1.5 the DjangoJSONEncoder is a subclass of json.JSONEncoder from the stdlib json. However django-cms uses django.utils.simplejson, which is actually simplejson instead of the stdlib json, and that expects the DjangoJSONEncoder constructor to accept a use_decimal kwarg.

Patrick Lauber
Collaborator

could you open a pull request for this?

Iacopo Spalletti
Collaborator

Also, this is part of the django 1.6 support PR #1995

Paulo czpython was assigned
Charlie Denton

The referenced PR has been merged, so I presume this has been resolved and can be closed.

Iacopo Spalletti
Collaborator

Thanks for the reminder :)

Iacopo Spalletti yakky closed this
Charlie Denton

No problem ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.