summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2019-01-05 12:44:18 -0600
committerMichael Merickel <michael@merickel.org>2019-01-05 12:49:29 -0600
commit6de6df2a4227958006fc567256d03feb2da43742 (patch)
tree0a34a7546d4f830f90322a9862f0b54ff0d55ffd
parentd00d868881e2f5260170b48deacc57a8c21f1392 (diff)
downloadpyramid-6de6df2a4227958006fc567256d03feb2da43742.tar.gz
pyramid-6de6df2a4227958006fc567256d03feb2da43742.tar.bz2
pyramid-6de6df2a4227958006fc567256d03feb2da43742.zip
stop overriding request.json_body from webob
-rw-r--r--CHANGES.rst4
-rw-r--r--docs/api/request.rst11
-rw-r--r--docs/narr/webob.rst2
-rw-r--r--src/pyramid/request.py5
4 files changed, 5 insertions, 17 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 7772ac7e2..32963027c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -31,6 +31,10 @@ Features
to ``add_route`` is the empty string (``''``).
See https://github.com/Pylons/pyramid/pull/3420
+- No longer define ``pyramid.request.Request.json_body`` which is already
+ provided by WebOb. This allows the attribute to now be settable.
+ See https://github.com/Pylons/pyramid/pull/3447
+
Bug Fixes
---------
diff --git a/docs/api/request.rst b/docs/api/request.rst
index 50a34884b..e7b2edc9a 100644
--- a/docs/api/request.rst
+++ b/docs/api/request.rst
@@ -283,17 +283,6 @@
.. automethod:: resource_path
- .. attribute:: json_body
-
- This property will return the JSON-decoded variant of the request
- body. If the request body is not well-formed JSON, or there is no
- body associated with this request, this property will raise an
- exception.
-
- .. seealso::
-
- See also :ref:`request_json_body`.
-
.. method:: set_property(callable, name=None, reify=False)
Add a callable or a property descriptor to the request instance.
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 665bbddc9..e0524583f 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -287,7 +287,7 @@ that has a body suitable for reading via ``request.json_body`` using Python's
import json
json_payload = json.dumps({'a':1})
- headers = {'Content-Type':'application/json; charset=utf-8'}
+ headers = {'Content-Type':'application/json'}
req = urllib2.Request('http://localhost:6543/', json_payload, headers)
resp = urllib2.urlopen(req)
diff --git a/src/pyramid/request.py b/src/pyramid/request.py
index 23c00468d..b9bd7451a 100644
--- a/src/pyramid/request.py
+++ b/src/pyramid/request.py
@@ -1,5 +1,4 @@
from collections import deque
-import json
from zope.interface import implementer
from zope.interface.interface import InterfaceClass
@@ -229,10 +228,6 @@ class Request(
return False
return adapted is ob
- @property
- def json_body(self):
- return json.loads(text_(self.body, self.charset))
-
def route_request_iface(name, bases=()):
# zope.interface treats the __name__ as the __doc__ and changes __name__