Permalink
Browse files

stop overriding request.json_body from webob

  • Loading branch information...
mmerickel committed Jan 5, 2019
1 parent d00d868 commit 6de6df2a4227958006fc567256d03feb2da43742
Showing with 5 additions and 17 deletions.
  1. +4 −0 CHANGES.rst
  2. +0 −11 docs/api/request.rst
  3. +1 −1 docs/narr/webob.rst
  4. +0 −5 src/pyramid/request.py
@@ -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
---------

@@ -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.
@@ -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)
@@ -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 @@ def is_response(self, ob):
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__

0 comments on commit 6de6df2

Please sign in to comment.