Ticket #18023: simplejson_docs.diff
File simplejson_docs.diff, 6.1 KB (added by , 13 years ago) |
---|
-
new file docs/releases/1.5-alpha-1.txt
diff --git a/docs/releases/1.5-alpha-1.txt b/docs/releases/1.5-alpha-1.txt new file mode 100644 index 0000000..d9f567d
- + 1 ============================== 2 Django 1.5 alpha release notes 3 ============================== 4 5 *Jantober -21, 2012* 6 7 Welcome to Django 1.5 alpha! 8 9 This is the first in a series of preview/development releases leading up to 10 the eventual release of Django 1.5, scheduled for THE FUTURE. This release is 11 primarily targeted at developers who are interested in trying out new features 12 and testing the Django codebase to help identify and resolve bugs prior to the 13 final 1.5 release. 14 15 As such, this release is *not* intended for production use, and any such use 16 is discouraged. 17 18 Django 1.5 alpha includes various `new features`_ and some minor `backwards 19 incompatible changes`_. There are also some features that have been dropped, 20 which are detailed in :doc:`our deprecation plan </internals/deprecation>`, 21 and we've `begun the deprecation process for some features`_. 22 23 .. _`new features`: `What's new in Django 1.5`_ 24 .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.5`_ 25 .. _`begun the deprecation process for some features`: `Features deprecated in 1.5`_ 26 27 Overview 28 ======== 29 30 31 Python compatibility 32 ==================== 33 34 Django 1.5 has dropped support for Python 2.5. Python 2.6 is now the minimum 35 required Python version. Django is tested and supported on Python 2.6 and 36 2.7, and has experimental support for Python 3. 37 38 This change should affect only a small number of Django users, as most 39 operating-system vendors today are shipping Python 2.6 or newer as their default 40 version. If you're still using Python 2.5, however, you'll need to stick to 41 Django 1.4 until you can upgrade. Per :doc:`our support policy 42 </internals/release-process>`, Django 1.4 will continue to receive security 43 support until the release of Django 1.6. 44 45 What's new in Django 1.5 46 ======================== 47 48 Nothing yet. 49 50 Backwards incompatible changes in 1.5 51 ===================================== 52 53 This will be the most compatible release ever, so far. 54 55 Features deprecated in 1.5 56 ========================== 57 58 ``django.utils.simplejson`` 59 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 61 With the dropping of Python 2.5 support, all supported versions of Python 62 have the ``json`` module in their standard library. This module is actually 63 a version of simplejson distributed by Python, so Django no longer needs 64 to provide any JSON modules. Any use of ``django.utils.simplejson`` can be 65 safely changed to ``json``. 66 67 ``django.contrib.simplejson`` will continue to function until it is removed in 68 version 1.7. It will use simplejson if it 69 can find it on your system and fall back to the 70 json module in the standard library if it cannot. There are no longer any 71 cases where it will fall back to a module provided by Django. -
docs/releases/index.txt
diff --git a/docs/releases/index.txt b/docs/releases/index.txt index 72b6d8b..1ab7d4d 100644
a b notes. 81 81 .. toctree:: 82 82 :maxdepth: 1 83 83 84 1.5-alpha-1 84 85 1.4-beta-1 85 86 1.4-alpha-1 86 87 1.3-beta-1 -
docs/topics/class-based-views.txt
diff --git a/docs/topics/class-based-views.txt b/docs/topics/class-based-views.txt index 8059ed1..9a472fb 100644
a b different rendering behavior. 495 495 496 496 For example, a simple JSON mixin might look something like this:: 497 497 498 import json 498 499 from django import http 499 from django.utils import simplejson as json500 500 501 501 class JSONResponseMixin(object): 502 502 def render_to_response(self, context): -
docs/topics/serialization.txt
diff --git a/docs/topics/serialization.txt b/docs/topics/serialization.txt index d7d72ec..ffbf9b1 100644
a b Identifier Information 143 143 ========== ============================================================== 144 144 ``xml`` Serializes to and from a simple XML dialect. 145 145 146 ``json`` Serializes to and from JSON_ (using a version of simplejson_ 147 bundled with Django). 146 ``json`` Serializes to and from JSON_. 148 147 149 148 ``yaml`` Serializes to YAML (YAML Ain't a Markup Language). This 150 149 serializer is only available if PyYAML_ is installed. 151 150 ========== ============================================================== 152 151 153 152 .. _json: http://json.org/ 154 .. _simplejson: http://undefined.org/python/#simplejson155 153 .. _PyYAML: http://www.pyyaml.org/ 156 154 157 155 Notes for specific serialization formats … … For example:: 169 167 json_serializer = serializers.get_serializer("json")() 170 168 json_serializer.serialize(queryset, ensure_ascii=False, stream=response) 171 169 172 The Django source code includes the simplejson_ module. However, if you're 173 using Python 2.6 or later (which includes a builtin version of the module), Django will 174 use the builtin ``json`` module automatically. If you have a system installed 175 version that includes the C-based speedup extension, or your system version is 176 more recent than the version shipped with Django (currently, 2.0.7), the 177 system version will be used instead of the version included with Django. 178 179 Be aware that if you're serializing using that module directly, not all Django 180 output can be passed unmodified to simplejson. In particular, :ref:`lazy 170 Be aware, not all Django output can be passed unmodified 171 to the json serializer. In particular, :ref:`lazy 181 172 translation objects <lazy-translations>` need a `special encoder`_ written for 182 173 them. Something like this will work:: 183 174 184 175 from django.utils.functional import Promise 185 176 from django.utils.encoding import force_unicode 186 177 187 class LazyEncoder( simplejson.JSONEncoder):178 class LazyEncoder(json.JSONEncoder): 188 179 def default(self, obj): 189 180 if isinstance(obj, Promise): 190 181 return force_unicode(obj) 191 182 return super(LazyEncoder, self).default(obj) 192 183 193 .. _special encoder: http:// svn.red-bean.com/bob/simplejson/tags/simplejson-1.7/docs/index.html184 .. _special encoder: http://docs.python.org/library/json.html#encoders-and-decoders 194 185 195 186 .. _topics-serialization-natural-keys: 196 187