summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMattBlack85 <promat85@gmail.com>2014-02-16 12:21:35 +0100
committerMattBlack85 <promat85@gmail.com>2014-02-16 13:12:49 +0100
commit653527de40115ddab04a7dcc69134ee4be45fa01 (patch)
tree5e3919e874853b6c40c96337c457f5b3f26ce97c /docs
parent9db4271bd11ac23a5a5652bbcdf8fb6d4b997651 (diff)
Fixed #18745 - Documentation change explaining tuple to list with signing.
Thanks to lee for the report.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/signing.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/topics/signing.txt b/docs/topics/signing.txt
index 75f066837c..af787b5adb 100644
--- a/docs/topics/signing.txt
+++ b/docs/topics/signing.txt
@@ -145,7 +145,7 @@ If you wish to protect a list, tuple or dictionary you can do so using the
signing module's ``dumps`` and ``loads`` functions. These imitate Python's
pickle module, but use JSON serialization under the hood. JSON ensures that
even if your :setting:`SECRET_KEY` is stolen an attacker will not be able
-to execute arbitrary commands by exploiting the pickle format.::
+to execute arbitrary commands by exploiting the pickle format::
>>> from django.core import signing
>>> value = signing.dumps({"foo": "bar"})
@@ -154,6 +154,15 @@ to execute arbitrary commands by exploiting the pickle format.::
>>> signing.loads(value)
{'foo': 'bar'}
+Because of the nature of JSON (there is no native distinction between lists
+and tuples) if you pass in a tuple, you will get a list from
+``signing.loads(object)``::
+
+ >>> from django.core import signing
+ >>> value = signing.dumps(('a','b','c'))
+ >>> signing.loads(value)
+ ['a', 'b', 'c']
+
.. function:: dumps(obj, key=None, salt='django.core.signing', compress=False)
Returns URL-safe, sha1 signed base64 compressed JSON string. Serialized