summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2015-07-15 01:44:01 -0400
committerChris McDonough <chrism@plope.com>2015-07-15 01:44:01 -0400
commit8447260de970629be01de821e43e9ea33e4405a0 (patch)
tree5140e4a3a228ddfb43c2ebc84137f87c5aa5b0fe /docs
parentf3b0c71139da13c88a660ef6edbe4d37ecb9e508 (diff)
downloadpyramid-8447260de970629be01de821e43e9ea33e4405a0.tar.gz
pyramid-8447260de970629be01de821e43e9ea33e4405a0.tar.bz2
pyramid-8447260de970629be01de821e43e9ea33e4405a0.zip
fix for #1846, incorrect pointers to nonexistent webob properties
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/webob.rst32
1 files changed, 14 insertions, 18 deletions
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 0eb070b06..f82cf6fbe 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -191,25 +191,21 @@ of them. Here are a couple that might be useful:
this for subrequests, or testing.
.. index::
- single: request (and unicode)
- single: unicode (and the request)
+ single: request (and text/unicode)
+ single: unicode and text (and the request)
-Unicode
-+++++++
+Text (Unicode)
+++++++++++++++
-Many of the properties in the request object will return unicode
-values if the request encoding/charset is provided. The client *can*
+Many of the properties of the request object will be text values (``unicode``
+under Python 2 or ``str`` under Python 3) if the request encoding/charset is
+provided. If it is provided, the values in ``req.POST``, ``req.GET``,
+``req.params``, and ``req.cookies`` will contain text. The client *can*
indicate the charset with something like ``Content-Type:
-application/x-www-form-urlencoded; charset=utf8``, but browsers seldom
-set this. You can set the charset with ``req.charset = 'utf8'``, or
-during instantiation with ``Request(environ, charset='utf8')``. If
-you subclass ``Request`` you can also set ``charset`` as a class-level
-attribute.
-
-If it is set, then ``req.POST``, ``req.GET``, ``req.params``, and
-``req.cookies`` will contain unicode strings. Each has a
-corresponding ``req.str_*`` (e.g., ``req.str_POST``) that is always
-a ``str``, and never unicode.
+application/x-www-form-urlencoded; charset=utf8``, but browsers seldom set
+this. You can reset the charset of an existing request with ``newreq =
+req.decode('utf-8')``, or during instantiation with ``Request(environ,
+charset='utf8')``.
.. index::
single: multidict (WebOb)
@@ -404,7 +400,7 @@ A response object has three fundamental parts:
``response.app_iter``:
An iterable (such as a list or generator) that will produce the
content of the response. This is also accessible as
- ``response.body`` (a string), ``response.unicode_body`` (a
+ ``response.body`` (a string), ``response.text`` (a
unicode object, informed by ``response.charset``), and
``response.body_file`` (a file-like object; writing to it appends
to ``app_iter``).
@@ -420,7 +416,7 @@ Here are some highlights:
``response.charset``:
The ``charset`` parameter of the content-type, it also informs
- encoding in ``response.unicode_body``.
+ encoding in ``response.text``.
``response.content_type_params`` is a dictionary of all the
parameters.