diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-01-06 05:13:02 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-01-06 05:13:02 +0000 |
| commit | a9c2f033cdbef3e53f6d48bb5aadb89ed761e579 (patch) | |
| tree | 80c62dcc7f73a9ebcd97433741da11101edd29a3 /docs | |
| parent | 3b489b77429aacd05a66c2158edc4f21209aecb9 (diff) | |
Upgraded included simplejson to 2.0.7.
Also changed importing logic to prefer a system-installed version of
simplejson (unless it's an earlier version that does not contian the C
speedups), then the json module from Python 2.6, then the version
shipped with Django.
Fixed #9266.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9707 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/serialization.txt | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/docs/topics/serialization.txt b/docs/topics/serialization.txt index 78bf6f5f03..a9366d6967 100644 --- a/docs/topics/serialization.txt +++ b/docs/topics/serialization.txt @@ -162,11 +162,17 @@ For example:: json_serializer = serializers.get_serializer("json")() json_serializer.serialize(queryset, ensure_ascii=False, stream=response) -The Django source code includes the simplejson_ module. Be aware that if you're -serializing using that module directly, not all Django output can be passed -unmodified to simplejson. In particular, :ref:`lazy translation objects -<lazy-translations>` need a `special encoder`_ written for them. Something like -this will work:: +The Django source code includes the simplejson_ module. However, if you're +using Python 2.6 (which includes a builtin version of the module), Django will +use the builtin ``json`` module automatically. If you have a system installed +version that includes the C-based speedup extension, or your system version is +more recent than the version shipped with Django (currently, 2.0.7), the +system version will be used instead of the version included with Django. + +Be aware that if you're serializing using that module directly, not all Django +output can be passed unmodified to simplejson. In particular, :ref:`lazy +translation objects <lazy-translations>` need a `special encoder`_ written for +them. Something like this will work:: from django.utils.functional import Promise from django.utils.encoding import force_unicode @@ -178,3 +184,4 @@ this will work:: return obj .. _special encoder: http://svn.red-bean.com/bob/simplejson/tags/simplejson-1.7/docs/index.html + |
