From a9c2f033cdbef3e53f6d48bb5aadb89ed761e579 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 6 Jan 2009 05:13:02 +0000 Subject: 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 --- docs/topics/serialization.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'docs') 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 -` 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 ` 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 + -- cgit v1.3