WebOb-1.8.6/ 0000755 0000766 0000024 00000000000 13611756053 013501 5 ustar xistence staff 0000000 0000000 WebOb-1.8.6/.coveragerc 0000644 0000766 0000024 00000000217 13357731131 015617 0 ustar xistence staff 0000000 0000000 [run]
parallel = true
source =
webob
[paths]
source =
src/webob
*/site-packages/webob
[report]
show_missing = true
precision = 2
WebOb-1.8.6/.gitignore 0000644 0000766 0000024 00000000262 13261302253 015457 0 ustar xistence staff 0000000 0000000 *$py.class
*.egg
*.pyc
*.pyo
*.swp
*~
.*.swp
.tox/
__pycache__/
_build/
build/
dist/
env*/
.coverage
.coverage.*
.cache/
WebOb.egg-info/
pytest*.xml
coverage*.xml
.pytest_cache/
WebOb-1.8.6/.travis.yml 0000644 0000766 0000024 00000001230 13611751037 015603 0 ustar xistence staff 0000000 0000000 # Wire up travis
language: python
sudo: false
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.6
env: TOXENV=docs
- python: nightly
env: TOXENV=py37
- python: pypy
env: TOXENV=pypy
- python: 3.6
env: TOXENV=py27,py36,coverage
allow_failures:
- env: TOXENV=py37
install:
- travis_retry pip install tox
script:
- travis_retry tox
notifications:
email:
- pyramid-checkins@lists.repoze.org
WebOb-1.8.6/CHANGES.txt 0000644 0000766 0000024 00000017232 13611752074 015316 0 ustar xistence staff 0000000 0000000 1.8.6 (2020-01-21)
------------------
Experimental Features
~~~~~~~~~~~~~~~~~~~~~
- The SameSite value now includes a new option named "None", this is a new
change that was introduced in
https://tools.ietf.org/html/draft-west-cookie-incrementalism-00
Please be aware that older clients are incompatible with this change:
https://www.chromium.org/updates/same-site/incompatible-clients, WebOb does
not enable SameSite on cookies by default, so there is no backwards
incompatible change here.
See https://github.com/Pylons/webob/issues/406
- Validation of SameSite values can be disabled by toggling a module flag. This
is in anticipation of future changes in evolving cookie standards.
The discussion in https://github.com/Pylons/webob/pull/407 (which initially
expanded the allowed options) notes the sudden change to browser cookie
implementation details may happen again.
In May 2019, Google announced a new model for privacy controls in their
browsers, which affected the list of valid options for the SameSite attribute
of cookies. In late 2019, the company began to roll out these changes to their
browsers to force developer adoption of the new specification.
See https://www.chromium.org/updates/same-site and
https://blog.chromium.org/2019/10/developers-get-ready-for-new.html for more
details on this change.
See https://github.com/Pylons/webob/pull/409
1.8.5 (2019-01-03)
------------------
Warnings
~~~~~~~~
- Fixed one last remaining invalid escape sequence in a docstring.
1.8.4 (2018-11-11)
------------------
Bugfix
~~~~~~
- Response.content_type now accepts unicode strings on Python 2 and encodes
them to latin-1. See https://github.com/Pylons/webob/pull/389 and
https://github.com/Pylons/webob/issues/388
- Accept header classes now support a .copy() function that may be used to
create a copy. This allows ``create_accept_header`` and other like functions
to accept an pre-existing Accept header. See
https://github.com/Pylons/webob/pull/386 and
https://github.com/Pylons/webob/issues/385
Warnings
~~~~~~~~
- Some backslashes introduced with the new accept handling code were causing
DeprecationWarnings upon compiling the source to pyc files, all of the
backslashes have been reigned in as appropriate, and users should no longer
see DeprecationWarnings for invalid escape sequence. See
https://github.com/Pylons/webob/issues/384
1.8.3 (2018-10-14)
------------------
Bugfix
~~~~~~
- ``acceptparse.AcceptValidHeader``, ``acceptparse.AcceptInvalidHeader``, and
``acceptparse.AcceptNoHeader`` will now always ignore offers that do not
match the required media type grammar when calling ``.acceptable_offers()``.
Previous versions raised a ``ValueError`` for invalid offers in
``AcceptValidHeader`` and returned them as acceptable in the others.
See https://github.com/Pylons/webob/pull/372
Feature
~~~~~~~
- Add Request.remote_host, exposing REMOTE_HOST environment variable.
- Added ``acceptparse.Accept.parse_offer`` to codify what types of offers
are compatible with ``acceptparse.AcceptValidHeader.acceptable_offers``,
``acceptparse.AcceptMissingHeader.acceptable_offers``, and
``acceptparse.AcceptInvalidHeader.acceptable_offers``. This API also
normalizes the offer with lowercased type/subtype and parameter names.
See https://github.com/Pylons/webob/pull/376 and
https://github.com/Pylons/webob/pull/379
1.8.2 (2018-06-05)
------------------
Bugfix
~~~~~~
- SameSite may now be passed as str or bytes to `Response.set_cookie` and
`cookies.make_cookie`. This was an oversight as all other arguments would be
correctly coerced before being serialized. See
https://github.com/Pylons/webob/issues/361 and
https://github.com/Pylons/webob/pull/362
1.8.1 (2018-04-10)
------------------
Bugfix
~~~~~~
- acceptparse.MIMEAccept which is deprecated in WebOb 1.8.0 made a backwards
incompatible change that led to it raising on an invalid Accept header. This
behaviour has now been reversed, as well as some other fixes to allow
MIMEAccept to behave more like the old version. See
https://github.com/Pylons/webob/pull/356
1.8.0 (2018-04-04)
------------------
Feature
~~~~~~~
- ``request.POST`` now supports any requests with the appropriate
Content-Type. Allowing any HTTP method to access form encoded content,
including DELETE, PUT, and others. See
https://github.com/Pylons/webob/pull/352
Compatibility
~~~~~~~~~~~~~
- WebOb is no longer officially supported on Python 3.3 which was EOL'ed on
2017-09-29.
Backwards Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Many changes have been made to the way WebOb does Accept handling, not just
for the Accept header itself, but also for Accept-Charset, Accept-Encoding
and Accept-Language. This was a `Google Summer of Code
`_ project completed by
Whiteroses (https://github.com/whiteroses). Many thanks to Google for running
GSoC, the Python Software Foundation for organising and a huge thanks to Ira
for completing the work. See https://github.com/Pylons/webob/pull/338 and
https://github.com/Pylons/webob/pull/335. Documentation is available at
https://docs.pylonsproject.org/projects/webob/en/master/api/webob.html
- When calling a ``@wsgify`` decorated function, the default arguments passed
to ``@wsgify`` are now used when called with the request, and not as a
`start_response`
.. code::
def hello(req, name):
return "Hello, %s!" % name
app = wsgify(hello, args=("Fred",))
req = Request.blank('/')
resp = req.get_response(app) # => "Hello, Fred"
resp2 = app(req) # => "Hello, Fred"
Previously the ``resp2`` line would have failed with a ``TypeError``. With
this change there is no way to override the default arguments with no
arguments. See https://github.com/Pylons/webob/pull/203
- When setting ``app_iter`` on a ``Response`` object the ``content_md5`` header
is no longer cleared. This behaviour is odd and disallows setting the
``content_md5`` and then returning an iterator for chunked content encoded
responses. See https://github.com/Pylons/webob/issues/86
Experimental Features
~~~~~~~~~~~~~~~~~~~~~
These features are experimental and may change at any point in the future.
- The cookie APIs now have the ability to set the SameSite attribute on a
cookie in both ``webob.cookies.make_cookie`` and
``webob.cookies.CookieProfile``. See https://github.com/Pylons/webob/pull/255
Bugfix
~~~~~~
- Exceptions now use string.Template.safe_substitute rather than
string.Template.substitute. The latter would raise for missing mappings, the
former will simply not substitute the missing variable. This is safer in case
the WSGI environ does not contain the keys necessary for the body template.
See https://github.com/Pylons/webob/issues/345.
- Request.host_url, Request.host_port, Request.domain correctly parse IPv6 Host
headers as provided by a browser. See
https://github.com/Pylons/webob/pull/332
- Request.authorization would raise ValueError for unusual or malformed header
values. See https://github.com/Pylons/webob/issues/231
- Allow unnamed fields in form data to be properly transcoded when calling
request.decode with an alternate encoding. See
https://github.com/Pylons/webob/pull/309
- ``Response.__init__`` would discard ``app_iter`` when a ``Response`` had no
body, this would cause issues when ``app_iter`` was an object that was tied
to the life-cycle of a web application and had to be properly closed.
``app_iter`` is more advanced API for ``Response`` and thus even if it
contains a body and is thus against the HTTP RFC's, we should let the users
shoot themselves by returning a body. See
https://github.com/Pylons/webob/issues/305
WebOb-1.8.6/HISTORY.txt 0000644 0000766 0000024 00000143672 13611751037 015415 0 ustar xistence staff 0000000 0000000 1.7rc1 (2016-11-18)
-------------------
Compatibility
~~~~~~~~~~~~~
- WebOb is no longer supported on Python 2.6 and PyPy3 (due to pip no longer
supporting Python 3.2 even on PyPy)
Backwards Incompatibility
~~~~~~~~~~~~~~~~~~~~~~~~~
- ``Response.set_cookie`` no longer accepts a key argument. This was deprecated
in WebOb 1.5 and as mentioned in the deprecation, is being removed in 1.7
- ``Response.__init__`` will no longer set the default Content-Type, nor
Content-Length on Responses that don't have a body. This allows WebOb to
return proper responses for things like `Response(status='204 No Content')`.
- ``Response.text`` will no longer raise if the Content-Type does not have a
charset, it will fall back to using the new ``default_body_encoding`. To get
the old behaviour back please sub-class ``Response`` and set
``default_body_encoding`` to ``None``. See
https://github.com/Pylons/webob/pull/287
- WebOb no longer supports Chunked Encoding, this means that if you are using
WebOb and need Chunked Encoding you will be required to have a proxy that
unchunks the request for you. Please read
https://github.com/Pylons/webob/issues/279 for more background.
Feature
~~~~~~~
- ``Response`` has a new ``default_body_encoding`` which may be used to allow
getting/setting ``Response.text`` when a Content-Type has no charset. See
https://github.com/Pylons/webob/pull/287
- ``webob.Request`` with any HTTP method is now allowed to have a body. This
allows DELETE to have a request body for passing extra information. See
https://github.com/Pylons/webob/pull/283 and
https://github.com/Pylons/webob/pull/274
- Add ``tell()`` to ``ResponseBodyFile`` so that it may be used for example for
zipfile support. See https://github.com/Pylons/webob/pull/117
- Allow the return from ``wsgify.middleware`` to be used as a decorator. See
https://github.com/Pylons/webob/pull/228
Bugfix
~~~~~~
- Fixup ``cgi.FieldStorage`` on Python 3.x to work-around issue reported in
Python bug report 27777 and 24764. This is currently applied for Python
versions less than 3.7. See https://github.com/Pylons/webob/pull/294
- ``Response.set_cookie`` now accepts ``datetime`` objects for the ``expires``
kwarg and will correctly convert them to UTC with no tzinfo for use in
calculating the ``max_age``. See https://github.com/Pylons/webob/issues/254
and https://github.com/Pylons/webob/pull/292
- Fixes ``request.PATH_SAFE`` to contain all of the path safe characters
according to RFC3986. See https://github.com/Pylons/webob/pull/291
- WebOb's exceptions will lazily read underlying variables when inserted into
templates to avoid expensive computations/crashes when inserting into the
template. This had a bad performance regression on Py27 because of the way
the lazified class was created and returned. See
https://github.com/Pylons/webob/pull/284
- ``wsgify.__call__`` raised a ``TypeError`` with an unhelpful message, it will
now return the ``repr`` for the wrapped function:
https://github.com/Pylons/webob/issues/119
- ``Response.content_type`` removes the charset content-type parameter unless
the new content-type is a text like type that has a charset parameter. See
https://github.com/Pylons/webob/pull/261 and
https://github.com/Pylons/webob/issues/130
- ``Response.json``'s ``json.dumps``/``json.loads`` are now always UTF-8. It no
longer tries to use the charset.
- The ``Response.__init__`` will by default no longer set the Content-Type to
the default if a ``headerlist`` is provided. This fixes issues whereby
``Request.get_response()`` would return a Response that didn't match the
actual response. See https://github.com/Pylons/webob/pull/261 and
https://github.com/Pylons/webob/issues/205
- Cleans up the remainder of the issues with the updated WebOb exceptions that
were taught to return JSON in version 1.6. See
https://github.com/Pylons/webob/issues/237 and
https://github.com/Pylons/webob/issues/236
- ``Response.from_file`` now parses the status line correctly when the status
line contains an HTTP with version, as well as a status text that contains
multiple white spaces (e.g HTTP/1.1 404 Not Found). See
https://github.com/Pylons/webob/issues/250
- ``Response`` now has a new property named ``has_body`` that may be used to
interrogate the ``Response`` to find out if ``Response.body`` is or isn't
set.
This is used in the exception handling code so that if you use a WebOb HTTP
Exception and pass a generator to ``app_iter`` WebOb won't attempt to read
the whole thing and instead allows it to be returned to the WSGI server. See
https://github.com/Pylons/webob/pull/259
1.6.0 (2016-03-15)
------------------
Compatibility
~~~~~~~~~~~~~
- Python 3.2 is no longer supported by WebOb
Bugfix
~~~~~~
- Request.decode attempted to read from the an already consumed stream, it has
now been redirected to another stream to read from. See
https://github.com/Pylons/webob/pull/183
- The application/json media type does not allow for a charset as discovery of
the encoding is done at the JSON layer. Upon initialization of a Response
WebOb will no longer add a charset if the content-type is set to JSON. See
https://github.com/Pylons/webob/pull/197 and
https://github.com/Pylons/pyramid/issues/1611
Features
~~~~~~~~
- Lazily HTML escapes environment keys in HTTP Exceptions so that those keys in
the environ that are not used in the output of the page don't raise an
exception due to inability to be properly escaped. See
https://github.com/Pylons/webob/pull/139
- MIMEAccept now accepts comparisons against wildcards, this allows one to
match on just the media type or sub-type, without having to explicitly match
on both the media type and sub-type at the same time. See
https://github.com/Pylons/webob/pull/185
- Add the ability to return a JSON body from an exception. Using the Accept
information in the request, the exceptions will now automatically return a
JSON version of the exception instead of just HTML or text. See
https://github.com/Pylons/webob/pull/230 and
https://github.com/Pylons/webob/issues/209
Security
~~~~~~~~
- exc._HTTPMove and any subclasses will now raise a ValueError if the location
field contains a line feed or carriage return. These values may lead to
possible HTTP Response Splitting. The header_getter descriptor has also been
modified to no longer accept headers with a line feed or carriage return.
See: https://github.com/Pylons/webob/pull/229 and
https://github.com/Pylons/webob/issues/217
1.5.1 (2015-10-30)
------------------
Bug Fixes
~~~~~~~~~
- The exceptions HTTPNotAcceptable, HTTPUnsupportedMediaType and
HTTPNotImplemented will now correctly use the sub-classed template rather
than the default error template. See https://github.com/Pylons/webob/issues/221
- Response's from_file now correctly deals with a status line that contains an
HTTP version identifier. HTTP/1.1 200 OK is now correctly parsed, whereas
before this would raise an error upon setting the Response.status in
from_file. See https://github.com/Pylons/webob/issues/121
1.5.0 (2015-10-11)
------------------
Bug Fixes
~~~~~~~~~
- The cookie API functions will now make sure that `max_age` is an integer or
an string that can convert to an integer. Previously passing in
max_age='test' would have silently done the wrong thing.
Features
~~~~~~~~
- Unbreak req.POST when the request method is PATCH. Instead of returning
something cmpletely unrelated we return NoVar. See:
https://github.com/Pylons/webob/pull/215
- HTTP Status Code 308 is now supported as a Permanent Redirect. See
https://github.com/Pylons/webob/pull/207
Backwards Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``Response.set_cookie`` renamed the only required parameter from "key" to
"name". The code will now still accept "key" as a keyword argument, and will
issue a DeprecationWarning until WebOb 1.7.
- The ``status`` attribute of a ``Response`` object no longer takes a string
like ``None None`` and allows that to be set as the status. It now has to at
least match the pattern of `` ``. Invalid status strings will now raise a ``ValueError``.
1.5.0a0 (2015-07-25)
--------------------
Backwards Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``Morsel`` will no longer accept a cookie value that does not meet RFC6265's
cookie-octet specification. Upon calling ``Morsel.serialize`` a warning will
be issued, in the future this will raise a ``ValueError``, please update your
cookie handling code. See https://github.com/Pylons/webob/pull/172
The cookie-octet specification in RFC6265 states the following characters are
valid in a cookie value:
=============== =======================================
Hex Range Actual Characters
=============== =======================================
``[0x21 ]`` ``!``
``[0x25-0x2B]`` ``#$%&'()*+``
``[0x2D-0x3A]`` ``-./0123456789:``
``[0x3C-0x5B]`` ``<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[``
``[0x5D-0x7E]`` ``]^_`abcdefghijklmnopqrstuvwxyz{|}~``
=============== =======================================
RFC6265 suggests using base 64 to serialize data before storing data in a
cookie.
Cookies that meet the RFC6265 standard will no longer be quoted, as this is
unnecessary. This is a no-op as far as browsers and cookie storage is
concerned.
- ``Response.set_cookie`` now uses the internal ``make_cookie`` API, which will
issue warnings if cookies are set with invalid bytes. See
https://github.com/Pylons/webob/pull/172
Features
~~~~~~~~
- Add support for some new caching headers, stale-while-revalidate and
stale-if-error that can be used by reverse proxies to cache stale responses
temporarily if the backend disappears. From RFC5861. See
https://github.com/Pylons/webob/pull/189
Bug Fixes
~~~~~~~~~
- Response.status now uses duck-typing for integers, and has also learned to
raise a ValueError if the status isn't an integer followed by a space, and
then the reason. See https://github.com/Pylons/webob/pull/191
- Fixed a bug in ``webob.multidict.GetDict`` which resulted in the
QUERY_STRING not being updated when changes were made to query
params using ``Request.GET.extend()``.
- Read the body of a request if we think it might have a body. This fixes PATCH
to support bodies. See https://github.com/Pylons/webob/pull/184
- Response.from_file returns HTTP headers as latin1 rather than UTF-8, this
fixes the usage on Google AppEngine. See
https://github.com/Pylons/webob/issues/99 and
https://github.com/Pylons/webob/pull/150
- Fix a bug in parsing the auth parameters that contained bad white space. This
makes the parsing fall in line with what's required in RFC7235. See
https://github.com/Pylons/webob/issues/158
- Use '\r\n' line endings in ``Response.__str__``. See:
https://github.com/Pylons/webob/pull/146
Documentation Changes
~~~~~~~~~~~~~~~~~~~~~
- ``response.set_cookie`` now has proper documentation for ``max_age`` and
``expires``. The code has also been refactored to use ``cookies.make_cookie``
instead of duplicating the code. This fixes
https://github.com/Pylons/webob/issues/166 and
https://github.com/Pylons/webob/issues/171
- Documentation didn't match the actual code for the wsgify function signature.
See https://github.com/Pylons/webob/pull/167
- Remove the WebDAV only from certain HTTP Exceptions, these exceptions may
also be used by REST services for example.
1.4 (2014-05-14)
----------------
Features
~~~~~~~~
- Remove ``webob.__version__``, the version number had not been kept in sync
with the official pkg version. To obtain the WebOb version number, use
``pkg_resources.get_distribution('webob').version`` instead.
Bug Fixes
~~~~~~~~~
- Fix a bug in ``EmptyResponse`` that prevents it from setting self.close as
appropriate due to testing truthiness of object rather than if it is
something other than ``None``.
- Fix a bug in ``SignedSerializer`` preventing secrets from containing
higher-order characters. See https://github.com/Pylons/webob/issues/136
- Use the ``hmac.compare_digest`` method when available for constant-time
comparisons.
1.3.1 (2013-12-13)
------------------
Bug Fixes
~~~~~~~~~
- Fix a bug in ``SignedCookieProfile`` whereby we didn't keep the original
serializer around, this would cause us to have ``SignedSerializer`` be added on
top of a ``SignedSerializer`` which would cause it to be run twice when
attempting to verify a cookie. See https://github.com/Pylons/webob/pull/127
Backwards Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- When ``CookieProfile.get_value`` and ``SignedCookieProfile.get_value`` fails
to deserialize a badly encoded value, we now return ``None`` as if the cookie
was never set in the first place instead of allowing a ``ValueError`` to be
raised to the calling code. See https://github.com/Pylons/webob/pull/126
1.3 (2013-12-10)
----------------
Features
~~~~~~~~
- Added a read-only ``domain`` property to ``BaseRequest``. This property
returns the domain portion of the host value. For example, if the
environment contains an ``HTTP_HOST`` value of ``foo.example.com:8000``,
``request.domain`` will return ``foo.example.com``.
- Added five new APIs: ``webob.cookies.CookieProfile``,
``webob.cookies.SignedCookieProfile``, ``webob.cookies.JSONSerializer`` and
``webob.cookies.SignedSerializer``, and ``webob.cookies.make_cookie``. These
APIs are convenience APIs for generating and parsing cookie headers as well
as dealing with signing cookies.
- Cookies generated via webob.cookies quoted characters in cookie values that
did not need to be quoted per RFC 6265. The following characters are no
longer quoted in cookie values: ``~/=<>()[]{}?@`` . The full set of
non-letter-or-digit unquoted cookie value characters is now
``!#$%&'*+-.^_`|~/: =<>()[]{}?@``. See
http://tools.ietf.org/html/rfc6265#section-4.1.1 for more information.
- Cookie names are now restricted to the set of characters expected by RFC
6265. Previously they could contain unsupported characters such as ``/``.
- Older versions of Webob escaped the doublequote to ``\"`` and the backslash
to ``\\`` when quoting cookie values. Now, instead, cookie serialization
generates ``\042`` for the doublequote and ``\134`` for the backslash. This
is what is expected as per RFC 6265. Note that old cookie values that do
have the older style quoting in them will still be unquoted correctly,
however.
- Added support for draft status code 451 ("Unavailable for Legal Reasons").
See http://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00
- Added status codes 428, 429, 431 and 511 to ``util.status_reasons`` (they
were already present in a previous release as ``webob.exc`` exceptions).
Bug Fixes
~~~~~~~~~
- MIMEAccept happily parsed malformed wildcard strings like "image/pn*" at
parse time, but then threw an AssertionError during matching. See
https://github.com/Pylons/webob/pull/83 .
- Preserve document ordering of GET and POST request data when POST data passed
to Request.blank is a MultiDict. See https://github.com/Pylons/webob/pull/96
- Allow query strings attached to PATCH requests to populate request.params.
See https://github.com/Pylons/webob/pull/106
- Added Python 3.3 trove classifier.
1.2.3
------------
* Maintainership transferred to `Pylons Project `
* Fix parsing of form submissions where fields have
transfer-content-encoding headers.
1.2.2
------------
* Fix multiple calls to ``cache_expires()`` not fully overriding the
previously set headers.
* Fix parsing of form submissions where fields have different encodings.
1.2.1
------------
* Add index page (e.g., ``index.html``) support for
:class:`webob.static.DirectoryApp`.
* Detect mime-type when creating a test request with file uploads
(``Request.blank("/", POST=dict(file1=("foo.jpg", "xxx")))``)
* Relax parsing of ``Accept`` and ``Range`` headers to allow
uppercase and extra whitespace.
* Fix docs references to some deprecated classes.
1.2
------------
* Fix :mod:`webob.client` handling of connection-refused on Windows.
* Use ``simplejson`` in :mod:`webob.request` if present.
* Fix ``resp.retry_after = `` interpreting value as a UNIX timestamp
(should interpret as time delta in seconds).
1.2rc1
------------
* Add ``Response.json`` and ``Request.json`` which reads and sets the
body using a JSON encoding (previously only the readable attribute
``Request.json_body`` existed). ``Request.json_body`` is still
available as an alias.
* Rename ``Response.status_int`` to ``Response.status_code`` (the
``.status_int`` name is still available and will be supported
indefinitely).
* Add ``Request.text``, the unicode version of the request body
(similar to ``Response.text``).
* Add :mod:`webob.client` which contains the WSGI application
``send_request_app`` and ``SendRequest``. All requests sent to this
application are turned into HTTP requests.
* Renamed ``Request.get_response(app)`` to ``Request.send(app)``. The
``.get_response()`` name is still available.
* Use ``send_request_app`` as the default application for
``Request.send()``, so you can do:
``resp = Request.blank("http://python.org").send()``
* Add :mod:`webob.static` which contains two new WSGI applications,
:class:`FileApp` serve one static file and :class:`DirectoryApp` to serve
the content of a directory. They should provide a reusable implementation
of :doc:`file-example`. It also comes with support for ``wsgi.file_wrapper``.
The implementation has been imported and simplified from
:mod:`PasteOb.fileapp`.
* Add ``dev`` and ``docs`` setup.py aliases (to install development and docs
dependencies respectively, e.g. "python setup.py dev").
1.2b3
------------
* Added ``request.host_port`` API (returns port number implied by HTTP_HOST,
falling back to SERVER_PORT).
* Added ``request.client_addr`` API (returns IP address implied by
HTTP_X_FORWARDED_FOR, falling back to REMOTE_ADDR).
* Fix corner-case ``response.status_int`` and ``response.status`` mutation
bug on py3 (use explicit floor division).
* Backwards incompatibility: Request and BaseRequest objects now return
Unicode for ``request.path_info`` and ``request.script_name`` under Python
2. Rationale: the legacy behavior of returning the respective raw environ
values was nonsensical on Python 3. Working with non-ascii encoded environ
variables as raw WSGI values under Python 3 makes no sense, as PEP 3333
specifies that environ variables are bytes-tunneled-as-latin-1 strings.
If you don't care about Python 3, and you need strict backwards
compatibility, to get legacy behavior of returning bytes on Python 2 for
these attributes, use ``webob.LegacyRequest`` instead of ``webob.Request``.
Although it's possible to use ``webob.LegacyRequest`` under Python 3, it
makes no sense, and it should not be used there.
* The above backwards incompatibility fixed nonsensical behavior of
``request.host_url``, ``request.application_url``, ``request.path_url``,
``request.path``, ``request.path_qs``, ``request.url``,
``request.relative_url``, ``request.path_info_peek``,
``request.path_info_pop`` under Python 3. These methods previously dealt
with raw SCRIPT_NAME and PATH_INFO values, which caused nonsensical
results.
* The WebOb Request object now respects an additional WSGI environment
variable: ``webob.url_encoding``. ``webob.url_encoding`` will be used to
decode the raw WSGI PATH_INFO and SCRIPT_NAME variables when the
``request.path_info`` and ``request.script_name`` APIs are used.
* Request objects now accept an additional constructor parameter:
``url_encoding``. ``url_encoding`` will be used to decode PATH_INFO and
SCRIPT_NAME from its WSGI-encoded values. If ``webob.url_encoding`` is not
set in the environ and ``url_encoding`` is not passed to the Request
constructor, the default value ``utf-8`` will be used to decode the
PATH_INFO and SCRIPT_NAME.
Note that passing ``url_encoding`` will cause the WSGI environment variable
``webob.url_encoding`` to be set.
* Fix ``webob.response._request_uri`` internal function to generate sensible
request URI under Python 3. This fixed a problem under Python 3 if you
were using non-absolute Location headers in responses.
1.2b2
------
* Fix ``request.cookies.get('name', 'default')``. Previously ``default`` was
ignored.
1.2b1
---------
* Mutating the ``request.cookies`` property now reflects the mutations into
the ``HTTP_COOKIES`` environ header.
* ``Response.etag = (tag, False)`` sets weak etag.
* ``Range`` only parses single range now.
* ``Range.satisfiable(..)`` is gone.
* ``Accept.best_matches()`` is gone; use ``list(request.accept)`` or
``request.accept.best_match(..)`` instead (applies to all Accept-*
headers) or similar with ``request.accept_language``.
* ``Response.request`` and ``Response.environ`` attrs are undeprecated and no
longer raise exceptions when used. These can also be passed to the
Response constructor. This is to support codebases that pass them to the
constructor or assign them to a response instance. However, some behavior
differences from 1.1 exist. In particular, synchronization is no longer
done between environ and request attribute properties of Response; you may
pass either to the constructor (or both) or assign one or the other or
both, but they wont be managed specially and will remain the same over the
lifetime of the response just as you passed them. Default values for both
``request`` and ``environ`` on any given response are ``None`` now.
* Undeprecated ``uscript_name`` and ``upath_info``.
* For backwards compatibility purposes, switch ``req.script_name`` and
``path_info`` back again to contain "raw" undecoded native strings rather
than text. Use ``uscript_name`` and ``upath_info`` to get the text version
of SCRIPT_NAME and PATH_INFO.
* Don't raise an exception if ``unicode_errors`` or ``decode_param_names`` is
passed to the Request constructor. Instead, emit a warning. For benefit
of Pylons 1.X, which passes both.
* Don't raise an exception if HTTPException.exception is used; instead emit a
warning. For benefit of Pylons 1.X, which uses it.
1.2a2
---------
* ``req.script_name`` and ``path_info`` now contain text, not bytes.
* Deprecated ``uscript_name`` and ``upath_info``.
* ``charset`` argument to ``Request`` as well as the attribute can only
be set to UTF-8 or the value already present in the ``Content-Type`` header.
* ``unicode_errors`` attribute of ``Request`` and related functionality is gone.
* To process requests that come in an encoding different from UTF-8, the request
needs to be transcoded like this: ``req = req.decode('windows-1251')``
* Added support for weak ETag matching in conditional responses.
* Most of etag-related functionality was refactored.
1.2a1
---------
* Python 3.2 compatibility.
* No longer compatible with Python 2.5 (only 2.6, 2.7, and 3.2 are supported).
* Switched VCS from Mercurial to Git
* Moved development to `GitHub `_
* Added full history from PyCon 2011 sprint to the repository
* Change ``LimitedLengthFile`` and ``FakeCGIBody`` to inherit from
``io.RawIOBase`` and benefit from ``io.BufferedReader``.
* Do not set ``resp.request`` in ``req.get_response(app)``
* ``Response.request`` and ``.environ`` attrs are deprecated and raise exceptions
when used.
* Deprecated request attributes ``str_GET``, ``str_POST``, ``str_cookies`` and
``str_params`` now raise exceptions when touched.
* Remove testing dependency on WebTest.
* Remove UnicodeMultiDict class; the result of ``Request.GET`` and
``Request.POST`` is now just a plain ``MultiDict``.
* The ``decode_param_names`` Request constructor argument has been removed,
along with the ``Request.decode_param_names`` attribute.
* The ``Request.as_string()`` method is now better known as
``Request.as_bytes()``.
* The ``Request.from_string()`` method is now better known as
``Request.from_bytes()``.
* A new method named ``Request.as_text()`` now exists.
* A new method named ``Request.from_text()`` now exists.
* The ``webob.dec.wsgify`` repr() is now much less informative, but a lot
easier to test and maintain.
1.1.1
---------
* Fix disconnect detection being incorrect in some cases (`issue 21
`_).
* Fix exception when calling ``.accept.best_match(..)`` on a header containing
``'*'`` (instead of ``'*/*'``).
* Extract some of the ``Accept`` code into subclasses (``AcceptCharset``,
``AcceptLanguage``).
* Improve language matching so that the app can now offer a generic
language code and it will match any of the accepted dialects
(``'en' in AcceptLanguage('en-gb')``).
* Normalize locale names when matching
(``'en_GB' in AcceptLanguage('en-gb')``).
* Deprecate ``etag.weak_match(..)``.
* Deprecate ``Response.request`` and ``Response.environ`` attrs.
1.1
---------
* Remove deprecation warnings for ``unicode_body`` and ``ubody``.
1.1rc1
---------
* Deprecate ``Response.ubody`` / ``.unicode_body`` in favor of new ``.text`` attribute
(the old names will be removed in 1.3 or even later).
* Make ``Response.write`` much more efficient (`issue 18
`_).
* Make sure copying responses does not reset Content-Length or Content-MD5 of the
original (and that of future copies).
* Change ``del res.body`` semantics so that it doesn't make the response invalid,
but only removes the response body.
* Remove ``Response._body`` so the ``_app_iter`` is the only representation.
1.1b2
---------
* Add detection for browser / user-agent disconnects. If the client disconnected
before sending the entire request body (POST / PUT), ``req.POST``, ``req.body``
and other related properties and methods will raise an exception.
Previously this caused the application get a truncated request with no indication that it
is incomplete.
* Make ``Response.body_file`` settable. This is now valid:
``Response(body_file=open('foo.bin'), content_type=...)``
* Revert the restriction on req.body not being settable for GET and some
other requests. Such requests actually can have a body according to HTTP BIS
(see also `commit message `_)
* Add support for file upload testing via ``Request.blank(POST=..)``. Patch contributed by
Tim Perevezentsev. See also:
`ticket `_,
`changeset `_.
* Deprecate ``req.str_GET``, ``str_POST``, ``str_params`` and ``str_cookies`` (warning).
* Deprecate ``req.decode_param_names`` (warning).
* Change ``req.decode_param_names`` default to ``True``. This means that ``.POST``, ``.GET``,
``.params`` and ``.cookies`` keys are now unicode. This is necessary for WebOb to behave
as close as possible on Python 2 and Python 3.
1.1b1
---------
* We have acquired the webob.org domain, docs are now hosted at `docs.webob.org
`_
* Make ``accept.quality(..)`` return best match quality, not first match quality.
* Fix ``Range.satisfiable(..)`` edge cases.
* Make sure ``WSGIHTTPException`` instances return the same headers for ``HEAD``
and ``GET`` requests.
* Drop Python 2.4 support
* Deprecate ``HTTPException.exception`` (warning on use).
* Deprecate ``accept.first_match(..)`` (warning on use).
Use ``.best_match(..)`` instead.
* Complete deprecation of ``req.[str_]{post|query}vars`` properties
(exception on use).
* Remove ``FakeCGIBody.seek`` hack (no longer necessary).
1.0.8
------
* Escape commas in cookie values (see also:
`stdlib Cookie bug `_)
* Change cookie serialization to more closely match how cookies usually
are serialized (unquoted expires, semicolon separators even between morsels)
* Fix some rare cases in cookie parsing
* Enhance the req.is_body_readable to always guess GET, HEAD, DELETE and TRACE
as unreadable and PUT and POST as readable
(`issue 12 `_)
* Deny setting req.body or req.body_file to non-empty values for GET, HEAD and
other bodiless requests
* Fix running nosetests with arguments on UNIX systems
(`issue 11 `_)
1.0.7
------
* Fix ``Accept`` header matching for items with zero-quality
(`issue 10 `_)
* Hide password values in ``MultiDict.__repr__``
1.0.6
------
* Use ``environ['wsgi.input'].read()`` instead of ``.read(-1)`` because the former
is explicitly mentioned in PEP-3333 and CherryPy server does not support the latter.
* Add new ``environ['webob.is_body_readable']`` flag which specifies if the
input stream is readable even if the ``CONTENT_LENGTH`` is not set.
WebOb now only ever reads the input stream if the content-length is known
or this flag is set.
* The two changes above fix a hangup with CherryPy and wsgiref servers
(`issue 6 `_)
* ``req.body_file`` is now safer to read directly. For ``GET`` and other similar requests
it returns an empty ``StringIO`` or ``BytesIO`` object even if the server passed in
something else.
* Setting ``req.body_file`` to a string now produces a PendingDeprecationWarning.
It will produce DeprecationWarning in 1.1 and raise an error in 1.2. Either
set ``req.body_file`` to a file-like object or set ``req.body`` to a string value.
* Fix ``.pop()`` and ``.setdefault(..)`` methods of ``req/resp.cache_control``
* Thanks to the participants of `Pyramid sprint at the PyCon US 2011
`_ WebOb now has
100% test coverage.
1.0.5
------
* Restore Python 2.4 compatibility.
1.0.4
------
* The field names escaping bug semi-fixed in 1.0.3 and originally blamed on cgi module
was in fact a ``webob.request._encode_multipart`` bug (also in Google Chrome) and was
lurking in webob code for quite some time -- 1.0.2 just made it trigger more often.
Now it is fixed properly.
* Make sure that req.url and related properties do not unnecessarily escape some chars
(``:@&+$``) in the URI path (`issue 5 `_)
* Revert some changes from 1.0.3 that have broken backwards compatibility for some apps.
Getting ``req.body_file`` does not make input stream seekable, but there's a new property
``req.body_file_seekable`` that does.
* ``Request.get_response`` and ``Request.call_application`` seek the input body to start
before calling the app (if possible).
* Accessing ``req.body`` 'rewinds' the input stream back to pos 0 as well.
* When accessing ``req.POST`` we now avoid making the body seekable as the input stream data
are preserved in ``FakeCGIBody`` anyway.
* Add new method ``Request.from_string``.
* Make sure ``Request.as_string()`` uses CRLF to separate headers.
* Improve parity between ``Request.as_string()`` and ``.from_file``/``.from_string``
methods, so that the latter can parse output of the former and create a similar
request object which wasn't always the case previously.
1.0.3
------
* Correct a caching issue introduced in WebOb 1.0.2 that was causing unnecessary reparsing
of POST requests.
* Fix a bug regarding field names escaping for forms submitted as ``multipart/form-data``.
For more infromation see `the bug report and discussion
`_ and 1.0.4 notes for further fix.
* Add ``req.http_version`` attribute.
1.0.2
------
* Primary maintainer is now `Sergey Schetinin `_.
* Issue tracker moved from `Trac `_ to bitbucket's `issue
tracker `_
* WebOb 1.0.1 changed the behavior of ``MultiDict.update`` to be more in line with
other dict-like objects. We now also issue a warning when we detect that the
client code seems to expect the old, extending semantics.
* Make ``Response.set_cookie(key, None)`` set the 'delete-cookie' (same as ``.delete_cookie(key)``)
* Make ``req.upath_info`` and ``req.uscript_name`` settable
* Add :meth:``Request.as_string()`` method
* Add a ``req.is_body_seekable`` property
* Support for the ``deflate`` method with ``resp.decode_content()``
* To better conform to WSGI spec we no longer attempt to use seek on ``wsgi.input`` file
instead we assume it is not seekable unless ``env['webob.is_body_seekable']`` is set.
When making the body seekable we set that flag.
* A call to ``req.make_body_seekable()`` now guarantees that the body is seekable, is at 0 position
and that a correct ``req.content_length`` is present.
* ``req.body_file`` is always seekable. To access ``env['wsgi.input']`` without any processing,
use ``req.body_file_raw``. (Partially reverted in 1.0.4)
* Fix responses to HEAD requests with Range.
* Fix ``del resp.content_type``, ``del req.body``, ``del req.cache_control``
* Fix ``resp.merge_cookies()`` when called with an argument that is not a Response instance.
* Fix ``resp.content_body = None`` (was removing Cache-Control instead)
* Fix ``req.body_file = f`` setting ``CONTENT_LENGTH`` to ``-1`` (now removes from environ)
* Fix: make sure req.copy() leaves the original with seekable body
* Fix handling of WSGI environs with missing ``SCRIPT_NAME``
* A lot of tests were added by Mariano Mara and Danny Navarro.
1.0.1
-----
* As WebOb requires Python 2.4 or later, drop some compatibility modules
and update the code to use the decorator syntax.
* Implement optional on-the-fly response compression (``resp.encode_content(lazy=True)``)
* Drop ``util.safezip`` module and make ``util`` a module instead of a subpackage.
Merge ``statusreasons`` into it.
* Instead of using stdlib ``Cookie`` with monkeypatching, add a derived
but thoroughly rewritten, cleaner, safer and faster ``webob.cookies`` module.
* Fix: ``Response.merge_cookies`` now copies the headers before modification instead of
doing it in-place.
* Fix: setting request header attribute to ``None`` deletes that header.
(Bug only affected the 1.0 release).
* Use ``io.BytesIO`` for the request body file on Python 2.7 and newer.
* If a UnicodeMultiDict was used as the ``multi`` argument of another
UnicodeMultiDict, and a ``cgi.FieldStorage`` with a ``filename``
with high-order characters was present in the underlying
UnicodeMultiDict, a ``UnicodeEncodeError`` would be raised when any
helper method caused the ``_decode_value`` method to be called,
because the method would try to decode an already decoded string.
* Fix tests to pass under Python 2.4.
* Add descriptive docstrings to each exception in ``webob.exc``.
* Change the behaviour of ``MultiDict.update`` to overwrite existing header
values instead of adding new headers. The extending semantics are now available
via the ``extend`` method.
* Fix a bug in ``webob.exc.WSGIHTTPException.__init__``. If a list of
``headers`` was passed as a sequence which contained duplicate keys (for
example, multiple ``Set-Cookie`` headers), all but one of those headers
would be lost, because the list was effectively flattened into a dictionary
as the result of calling ``self.headers.update``. Fixed via calling
``self.headers.extend`` instead.
1.0
---
* 1.0, yay!
* Pull in werkzeug Cookie fix for malformed cookie bug.
* Implement :meth:`Request.from_file` and
:meth:`Response.from_file` which are kind of the inversion of
``str(req)`` and ``str(resp)``
* Add optional ``pattern`` argument to :meth:`Request.path_info_pop` that requires
the ``path_info`` segment to match the passed regexp to get popped and returned.
* Rewrite most of descriptor implementations for speed.
* Reorder descriptor declarations to group them by their semantics.
* Move code around so that there are fewer compat modules.
* Change :meth:``HTTPError.__str__`` to better conform to PEP 352.
* Make :attr:`Request.cache_control` a view on the headers.
* Correct Accept-Language and Accept-Charset matching to fully conform to the HTTP spec.
* Expose parts of :meth:`Request.blank` as :func:`environ_from_url`
and :func:`environ_add_POST`
* Fix Authorization header parsing for some corner cases.
* Fix an error generated if the user-agent sends a 'Content_Length' header
(note the underscore).
* Kill :attr:`Request.default_charset`. Request charset defaults to UTF-8.
This ensures that all values in ``req.GET``, ``req.POST`` and ``req.params``
are always unicode.
* Fix the ``headerlist`` and ``content_type`` constructor arguments priorities
for :class:`HTTPError` and subclasses.
* Add support for weak etags to conditional Response objects.
* Fix locale-dependence for some cookie dates strings.
* Improve overall test coverage.
* Rename class ``webob.datastruct.EnvironHeaders`` to ``webob.headers.EnvironHeaders``
* Rename class ``webob.headerdict.HeaderDict`` to ``webob.headers.ResponseHeaders``
* Rename class ``webob.updatedict.UpdateDict`` to ``webob.cachecontrol.UpdateDict``
0.9.8
-----
* Fix issue with WSGIHTTPException inadvertently generating unicode body
and failing to encode it
* WWW-Authenticate response header is accessible as
``response.www_authenticate``
* ``response.www_authenticate`` and ``request.authorization`` hold None
or tuple ``(auth_method, params)`` where ``params`` is a dictionary
(or a string when ``auth_method`` is not one of known auth schemes
and for Authenticate: Basic ...)
* Don't share response headers when getting a response like ``resp =
req.get_response(some_app)``; this can avoid some funny errors with
modifying headers and reusing Response objects.
* Add `overwrite` argument to :meth:`Response.set_cookie` that make the
new value overwrite the previously set. `False` by default.
* Add `strict` argument to :meth:`Response.unset_cookie` that controls
if an exception should be raised in case there are no cookies to unset.
`True` by default.
* Fix ``req.GET.copy()``
* Make sure that 304 Not Modified responses generated by
:meth:`Response.conditional_response_app` exclude Content-{Length/Type}
headers
* Fix ``Response.copy()`` not being an independent copy
* When the requested range is not satisfiable, return a 416 error
(was returning entire body)
* Truncate response for range requests that go beyond the end of body
(was treating as invalid).
0.9.7.1
-------
* Fix an import problem with Pylons
0.9.7
-----
* Moved repository from svn location to
http://bitbucket.org/ianb/webob/
* Arguments to :meth:`Accept.best_match` must be specific types,
not wildcards. The server should know a list of specic types it can
offer and use ``best_match`` to select a specific one.
* With ``req.accept.best_match([types])`` prefer the first type in the
list (previously it preferred later types).
* Also, make sure that if the user-agent accepts multiple types and
there are multiple matches to the types that the application offers,
``req.accept.best_match([..])`` returns the most specific match.
So if the server can satisfy either ``image/*`` or ``text/plain``
types, the latter will be picked independent from the order the accepted
or offered types are listed (given they have the same quality rating).
* Fix Range, Content-Range and AppIter support all of which were broken
in many ways, incorrectly parsing ranges, reporting incorrect
content-ranges, failing to generate the correct body to satisfy the range
from ``app_iter`` etc.
* Fix assumption that presense of a ``seek`` method means that the stream
is seekable.
* Add ``ubody`` alias for ``Response.unicode_body``
* Add Unicode versions of ``Request.script_name`` and ``path_info``:
``uscript_name`` and ``upath_info``.
* Split __init__.py into four modules: request, response, descriptors and
datetime_utils.
* Fix ``Response.body`` access resetting Content-Length to zero
for HEAD responses.
* Support passing Unicode bodies to :class:`WSGIHTTPException`
constructors.
* Make ``bool(req.accept)`` return ``False`` for requests with missing
Accept header.
* Add HTTP version to :meth:`Request.__str__` output.
* Resolve deprecation warnings for parse_qsl on Python 2.6 and newer.
* Fix :meth:`Response.md5_etag` setting Content-MD5 in incorrect
format.
* Add ``Request.authorization`` property for Authorization header.
* Make sure ETag value is always quoted (required by RFC)
* Moved most ``Request`` behavior into a new class named
``BaseRequest``. The ``Request`` class is now a superclass for
``BaseRequest`` and a simple mixin which manages
``environ['webob.adhoc_attrs']`` when ``__setitem__``,
``__delitem__`` and ``__getitem__`` are called. This allows
framework developers who do not want the
``environ['webob.adhoc_attrs']`` mutation behavior from
``__setattr__``. (chrism)
* Added response attribute ``response.content_disposition`` for its
associated header.
* Changed how ``charset`` is determined on :class:`webob.Request`
objects. Now the ``charset`` parameter is read on the Content-Type
header, if it is present. Otherwise a ``default_charset`` parameter
is read, or the ``charset`` argument to the Request constructor.
This is more similar to how :class:`webob.Response` handles the
charset.
* Made the case of the Content-Type header consistent (note: this
might break some doctests).
* Make ``req.GET`` settable, such that ``req.environ['QUERY_STRING']``
is updated.
* Fix problem with ``req.POST`` causing a re-parse of the body when
you instantiate multiple ``Request`` objects over the same environ
(e.g., when using middleware that looks at ``req.POST``).
* Recreate the request body properly when a ``POST`` includes file
uploads.
* When ``req.POST`` is updated, the generated body will include the
new values.
* Added a ``POST`` parameter to :meth:`webob.Request.blank`; when
given this will create a request body for the POST parameters (list
of two-tuples or dictionary-like object). Note: this does not
handle unicode or file uploads.
* Added method :meth:`webob.Response.merge_cookies`, which takes the
``Set-Cookie`` headers from a Response, and merges them with another
response or WSGI application. (This is useful for flash messages.)
* Fix a problem with creating exceptions like
``webob.exc.HTTPNotFound(body='',
content_type='application/xml')`` (i.e., non-HTML exceptions).
* When a Location header is not absolute in a Response, it will be
made absolute when the Response is called as a WSGI application.
This makes the response less bound to a specific request.
* Added :mod:`webob.dec`, a decorator for making WSGI applications
from functions with the signature ``resp = app(req)``.
0.9.6.1
-------
* Fixed :meth:`Response.__init__`, which for some content types would
raise an exception.
* The ``req.body`` property will not recreate a StringIO object
unnecessarily when rereading the body.
0.9.6
-----
* Removed `environ_getter` from :class:`webob.Request`. This
largely-unused option allowed a Request object to be instantiated
with a dynamic underlying environ. Since it wasn't used much, and
might have been ill-advised from the beginning, and affected
performance, it has been removed (from Chris McDonough).
* Speed ups for :meth:`webob.Response.__init__` and
:meth:`webob.Request.__init__`
* Fix defaulting of ``CONTENT_TYPE`` instead of ``CONTENT_LENGTH`` to
0 in ``Request.str_POST``.
* Added :meth:`webob.Response.copy`
0.9.5
-----
* Fix ``Request.blank('/').copy()`` raising an exception.
* Fix a potential memory leak with HEAD requests and 304 responses.
* Make :func:`webob.html_escape` respect the ``.__html__()`` magic
method, which allows you to use HTML in
:class:`webob.exc.HTTPException` instances.
* Handle unicode values for ``resp.location``.
* Allow arbitrary keyword arguments to ``exc.HTTP*`` (the same
keywords you can send to :class:`webob.Response`).
* Allow setting :meth:`webob.Response.cache_expires` (usually it is
called as a method). This is primarily to allow
``Response(cache_expires=True)``.
0.9.4
-----
* Quiet Python 2.6 deprecation warnings.
* Added an attribute ``unicode_errors`` to :class:`webob.Response` --
if set to something like ``unicode_errors='replace'`` it will decode
``resp.body`` appropriately. The default is ``strict`` (which was
the former un-overridable behavior).
0.9.3
-----
* Make sure that if changing the body the Content-MD5 header is
removed. (Otherwise a lot of middleware would accidentally
corrupt responses).
* Fixed ``Response.encode_content('identity')`` case (was a no-op even
for encoded bodies).
* Fixed :meth:`Request.remove_conditional_headers` that was removing
If-Match header instead of If-None-Match.
* Fixed ``resp.set_cookie(max_age=timedelta(...))``
* ``request.POST`` now supports PUT requests with the appropriate
Content-Type.
0.9.2
-----
* Add more arguments to :meth:`Request.remove_conditional_headers`
for more fine-grained control: `remove_encoding`, `remove_range`,
`remove_match`, `remove_modified`. All of them are `True` by default.
* Add an `set_content_md5` argument to :meth:`Response.md5_etag`
that calculates and sets Content-MD5 reponse header from current
body.
* Change formatting of cookie expires, to use the more traditional
format ``Wed, 5-May-2001 15:34:10 GMT`` (dashes instead of spaces).
Browsers should deal with either format, but some other code expects
dashes.
* Added in ``sorted`` function for backward compatibility with Python
2.3.
* Allow keyword arguments to :class:`webob.Request`, which assign
attributes (possibly overwriting values in the environment).
* Added methods :meth:`webob.Request.make_body_seekable` and
:meth:`webob.Request.copy_body`, which make it easier to share a
request body among different consuming applications, doing something
like `req.make_body_seekable(); req.body_file.seek(0)`
0.9.1
-----
* ``request.params.copy()`` now returns a writable MultiDict (before
it returned an unwritable object).
* There were several things broken with ``UnicodeMultiDict`` when
``decode_param_names`` is turned on (when the dictionary keys are
unicode).
* You can pass keyword arguments to ``Request.blank()`` that will be
used to construct ``Request`` (e.g., ``Request.blank('/',
decode_param_names=True)``).
* If you set headers like ``response.etag`` to a unicode value, they
will be encoded as ISO-8859-1 (however, they will remain encoded,
and ``response.etag`` will not be a unicode value).
* When parsing, interpret times with no timezone as UTC (previously
they would be interpreted as local time).
* Set the Expires property on cookies when using
``response.set_cookie()``. This is inherited from ``max_age``.
* Support Unicode cookie values
0.9
---
* Added ``req.urlarg``, which represents positional arguments in
``environ['wsgiorg.routing_args']``.
* For Python 2.4, added attribute get/set proxies on exception objects
from, for example, ``webob.exc.HTTPNotFound().exception``, so that
they act more like normal response objects (despite not being
new-style classes or ``webob.Response`` objects). In Python 2.5 the
exceptions are ``webob.Response`` objects.
Backward Incompatible Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* The ``Response`` constructor has changed: it is now ``Response([body],
[status], ...)`` (before it was ``Response([status], [body], ...)``).
Body may be str or unicode.
* The ``Response`` class defaults to ``text/html`` for the
Content-Type, and ``utf8`` for the charset (charset is only set on
``text/*`` and ``application/*+xml`` responses).
Bugfixes and Small Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~
* Use ``BaseCookie`` instead of ``SimpleCookie`` for parsing cookies.
* Added ``resp.write(text)`` method, which is equivalent to
``resp.body += text`` or ``resp.unicode_body += text``, depending on
the type of ``text``.
* The ``decode_param_names`` argument (used like
``Request(decode_param_names=True)``) was being ignored.
* Unicode decoding of file uploads and file upload filenames were
causing errors when decoding non-file-upload fields (both fixes from
Ryan Barrett).
0.8.5
-----
* Added response methods ``resp.encode_content()`` and
``resp.decode_content()`` to gzip or ungzip content.
* ``Response(status=404)`` now works (before you would have to use
``status="404 Not Found"``).
* Bugfix (typo) with reusing POST body.
* Added ``226 IM Used`` response status.
* Backport of ``string.Template`` included for Python 2.3
compatibility.
0.8.4
-----
* ``__setattr__`` would keep ``Request`` subclasses from having
properly settable environ proxies (like ``req.path_info``).
0.8.3
-----
* ``request.POST`` was giving FieldStorage objects for *every*
attribute, not just file uploads. This is fixed now.
* Added request attributes ``req.server_name`` and ``req.server_port``
for the environ keys ``SERVER_NAME`` and ``SERVER_PORT``.
* Avoid exceptions in ``req.content_length``, even if
``environ['CONTENT_LENGTH']`` is somehow invalid.
0.8.2
-----
* Python 2.3 compatibility: backport of ``reversed(seq)``
* Made separate ``.exception`` attribute on ``webob.exc`` objects,
since new-style classes can't be raised as exceptions.
* Deprecate ``req.postvars`` and ``req.queryvars``, instead using the
sole names ``req.GET`` and ``req.POST`` (also ``req.str_GET`` and
``req.str_POST``). The old names give a warning; will give an error
in next release, and be completely gone in the following release.
* ``req.user_agent`` is now just a simple string (parsing the
User-Agent header was just too volatile, and required too much
knowledge about current browsers). Similarly,
``req.referer_search_query()`` is gone.
* Added parameters ``version`` and ``comment`` to
``Response.set_cookie()``, per William Dode's suggestion.
* Was accidentally consuming file uploads, instead of putting the
``FieldStorage`` object directly in the parameters.
0.8.1
-----
* Added ``res.set_cookie(..., httponly=True)`` to set the ``HttpOnly``
attribute on the cookie, which keeps Javascript from reading the
cookie.
* Added some WebDAV-related responses to ``webob.exc``
* Set default ``Last-Modified`` when using ``response.cache_expire()``
(fixes issue with Opera)
* Generally fix ``.cache_control``
0.8
---
First release. Nothing is new, or everything is new, depending on how
you think about it.
WebOb-1.8.6/PKG-INFO 0000644 0000766 0000024 00000027523 13611756053 014607 0 ustar xistence staff 0000000 0000000 Metadata-Version: 2.1
Name: WebOb
Version: 1.8.6
Summary: WSGI request and response object
Home-page: http://webob.org/
Author: Ian Bicking
Author-email: ianb@colorstudy.com
Maintainer: Pylons Project
License: MIT
Description: WebOb
=====
.. image:: https://travis-ci.org/Pylons/webob.png?branch=master
:target: https://travis-ci.org/Pylons/webob
.. image:: https://readthedocs.org/projects/webob/badge/?version=stable
:target: https://docs.pylonsproject.org/projects/webob/en/stable/
:alt: Documentation Status
WebOb provides objects for HTTP requests and responses. Specifically
it does this by wrapping the `WSGI `_ request
environment and response status/headers/app_iter(body).
The request and response objects provide many conveniences for parsing
HTTP request and forming HTTP responses. Both objects are read/write:
as a result, WebOb is also a nice way to create HTTP requests and
parse HTTP responses.
Support and Documentation
-------------------------
See the `WebOb Documentation website `_ to view
documentation, report bugs, and obtain support.
License
-------
WebOb is offered under the `MIT-license
`_.
Authors
-------
WebOb was authored by Ian Bicking and is currently maintained by the `Pylons
Project `_ and a team of contributors.
1.8.6 (2020-01-21)
------------------
Experimental Features
~~~~~~~~~~~~~~~~~~~~~
- The SameSite value now includes a new option named "None", this is a new
change that was introduced in
https://tools.ietf.org/html/draft-west-cookie-incrementalism-00
Please be aware that older clients are incompatible with this change:
https://www.chromium.org/updates/same-site/incompatible-clients, WebOb does
not enable SameSite on cookies by default, so there is no backwards
incompatible change here.
See https://github.com/Pylons/webob/issues/406
- Validation of SameSite values can be disabled by toggling a module flag. This
is in anticipation of future changes in evolving cookie standards.
The discussion in https://github.com/Pylons/webob/pull/407 (which initially
expanded the allowed options) notes the sudden change to browser cookie
implementation details may happen again.
In May 2019, Google announced a new model for privacy controls in their
browsers, which affected the list of valid options for the SameSite attribute
of cookies. In late 2019, the company began to roll out these changes to their
browsers to force developer adoption of the new specification.
See https://www.chromium.org/updates/same-site and
https://blog.chromium.org/2019/10/developers-get-ready-for-new.html for more
details on this change.
See https://github.com/Pylons/webob/pull/409
1.8.5 (2019-01-03)
------------------
Warnings
~~~~~~~~
- Fixed one last remaining invalid escape sequence in a docstring.
1.8.4 (2018-11-11)
------------------
Bugfix
~~~~~~
- Response.content_type now accepts unicode strings on Python 2 and encodes
them to latin-1. See https://github.com/Pylons/webob/pull/389 and
https://github.com/Pylons/webob/issues/388
- Accept header classes now support a .copy() function that may be used to
create a copy. This allows ``create_accept_header`` and other like functions
to accept an pre-existing Accept header. See
https://github.com/Pylons/webob/pull/386 and
https://github.com/Pylons/webob/issues/385
Warnings
~~~~~~~~
- Some backslashes introduced with the new accept handling code were causing
DeprecationWarnings upon compiling the source to pyc files, all of the
backslashes have been reigned in as appropriate, and users should no longer
see DeprecationWarnings for invalid escape sequence. See
https://github.com/Pylons/webob/issues/384
1.8.3 (2018-10-14)
------------------
Bugfix
~~~~~~
- ``acceptparse.AcceptValidHeader``, ``acceptparse.AcceptInvalidHeader``, and
``acceptparse.AcceptNoHeader`` will now always ignore offers that do not
match the required media type grammar when calling ``.acceptable_offers()``.
Previous versions raised a ``ValueError`` for invalid offers in
``AcceptValidHeader`` and returned them as acceptable in the others.
See https://github.com/Pylons/webob/pull/372
Feature
~~~~~~~
- Add Request.remote_host, exposing REMOTE_HOST environment variable.
- Added ``acceptparse.Accept.parse_offer`` to codify what types of offers
are compatible with ``acceptparse.AcceptValidHeader.acceptable_offers``,
``acceptparse.AcceptMissingHeader.acceptable_offers``, and
``acceptparse.AcceptInvalidHeader.acceptable_offers``. This API also
normalizes the offer with lowercased type/subtype and parameter names.
See https://github.com/Pylons/webob/pull/376 and
https://github.com/Pylons/webob/pull/379
1.8.2 (2018-06-05)
------------------
Bugfix
~~~~~~
- SameSite may now be passed as str or bytes to `Response.set_cookie` and
`cookies.make_cookie`. This was an oversight as all other arguments would be
correctly coerced before being serialized. See
https://github.com/Pylons/webob/issues/361 and
https://github.com/Pylons/webob/pull/362
1.8.1 (2018-04-10)
------------------
Bugfix
~~~~~~
- acceptparse.MIMEAccept which is deprecated in WebOb 1.8.0 made a backwards
incompatible change that led to it raising on an invalid Accept header. This
behaviour has now been reversed, as well as some other fixes to allow
MIMEAccept to behave more like the old version. See
https://github.com/Pylons/webob/pull/356
1.8.0 (2018-04-04)
------------------
Feature
~~~~~~~
- ``request.POST`` now supports any requests with the appropriate
Content-Type. Allowing any HTTP method to access form encoded content,
including DELETE, PUT, and others. See
https://github.com/Pylons/webob/pull/352
Compatibility
~~~~~~~~~~~~~
- WebOb is no longer officially supported on Python 3.3 which was EOL'ed on
2017-09-29.
Backwards Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Many changes have been made to the way WebOb does Accept handling, not just
for the Accept header itself, but also for Accept-Charset, Accept-Encoding
and Accept-Language. This was a `Google Summer of Code
`_ project completed by
Whiteroses (https://github.com/whiteroses). Many thanks to Google for running
GSoC, the Python Software Foundation for organising and a huge thanks to Ira
for completing the work. See https://github.com/Pylons/webob/pull/338 and
https://github.com/Pylons/webob/pull/335. Documentation is available at
https://docs.pylonsproject.org/projects/webob/en/master/api/webob.html
- When calling a ``@wsgify`` decorated function, the default arguments passed
to ``@wsgify`` are now used when called with the request, and not as a
`start_response`
.. code::
def hello(req, name):
return "Hello, %s!" % name
app = wsgify(hello, args=("Fred",))
req = Request.blank('/')
resp = req.get_response(app) # => "Hello, Fred"
resp2 = app(req) # => "Hello, Fred"
Previously the ``resp2`` line would have failed with a ``TypeError``. With
this change there is no way to override the default arguments with no
arguments. See https://github.com/Pylons/webob/pull/203
- When setting ``app_iter`` on a ``Response`` object the ``content_md5`` header
is no longer cleared. This behaviour is odd and disallows setting the
``content_md5`` and then returning an iterator for chunked content encoded
responses. See https://github.com/Pylons/webob/issues/86
Experimental Features
~~~~~~~~~~~~~~~~~~~~~
These features are experimental and may change at any point in the future.
- The cookie APIs now have the ability to set the SameSite attribute on a
cookie in both ``webob.cookies.make_cookie`` and
``webob.cookies.CookieProfile``. See https://github.com/Pylons/webob/pull/255
Bugfix
~~~~~~
- Exceptions now use string.Template.safe_substitute rather than
string.Template.substitute. The latter would raise for missing mappings, the
former will simply not substitute the missing variable. This is safer in case
the WSGI environ does not contain the keys necessary for the body template.
See https://github.com/Pylons/webob/issues/345.
- Request.host_url, Request.host_port, Request.domain correctly parse IPv6 Host
headers as provided by a browser. See
https://github.com/Pylons/webob/pull/332
- Request.authorization would raise ValueError for unusual or malformed header
values. See https://github.com/Pylons/webob/issues/231
- Allow unnamed fields in form data to be properly transcoded when calling
request.decode with an alternate encoding. See
https://github.com/Pylons/webob/pull/309
- ``Response.__init__`` would discard ``app_iter`` when a ``Response`` had no
body, this would cause issues when ``app_iter`` was an object that was tied
to the life-cycle of a web application and had to be properly closed.
``app_iter`` is more advanced API for ``Response`` and thus even if it
contains a body and is thus against the HTTP RFC's, we should let the users
shoot themselves by returning a body. See
https://github.com/Pylons/webob/issues/305
Keywords: wsgi request web http
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*
Provides-Extra: testing
Provides-Extra: docs
WebOb-1.8.6/README.rst 0000644 0000766 0000024 00000002347 13611751037 015173 0 ustar xistence staff 0000000 0000000 WebOb
=====
.. image:: https://travis-ci.org/Pylons/webob.png?branch=master
:target: https://travis-ci.org/Pylons/webob
.. image:: https://readthedocs.org/projects/webob/badge/?version=stable
:target: https://docs.pylonsproject.org/projects/webob/en/stable/
:alt: Documentation Status
WebOb provides objects for HTTP requests and responses. Specifically
it does this by wrapping the `WSGI `_ request
environment and response status/headers/app_iter(body).
The request and response objects provide many conveniences for parsing
HTTP request and forming HTTP responses. Both objects are read/write:
as a result, WebOb is also a nice way to create HTTP requests and
parse HTTP responses.
Support and Documentation
-------------------------
See the `WebOb Documentation website `_ to view
documentation, report bugs, and obtain support.
License
-------
WebOb is offered under the `MIT-license
`_.
Authors
-------
WebOb was authored by Ian Bicking and is currently maintained by the `Pylons
Project `_ and a team of contributors. WebOb-1.8.6/RELEASING.rst 0000644 0000766 0000024 00000003234 13204653630 015541 0 ustar xistence staff 0000000 0000000 Releasing WebOb
===============
- For clarity, we define releases as follows.
- Alpha, beta, dev and similar statuses do not qualify whether a release is
major or minor. The term "pre-release" means alpha, beta, or dev.
- A release is final when it is no longer pre-release.
- A *major* release is where the first number either before or after the
first dot increases. Examples: 1.6.0 to 1.7.0a1, or 1.8.0 to 2.0.0.
- A *minor* or *bug fix* release is where the number after the second dot
increases. Example: 1.6.0 to 1.6.1.
Releasing
---------
- First install the required pre-requisites::
$ pip install setuptools_git twine
- Edit ``CHANGES.txt`` to add a release number and data and then modify
``setup.py`` to update the version number as well.
- Run ``python setup.py sdist bdist_wheel``, then verify ``dist/*`` hasn't
increased dramatically compared to previous versions (for example,
accidentally including a large file in the release or pyc files).
- Upload the resulting package to PyPi: ``twine upload
dist/WebOb-*{whl,tar.gz}``
Marketing and communications
----------------------------
- Announce to Twitter::
WebOb 1.x released.
PyPI
https://pypi.python.org/pypi/webob/1.x.y
Changes
http://docs.webob.org/en/1.x-branch/
Issues
https://github.com/Pylons/webob/issues
- Announce to maillist::
WebOb 1.x.y has been released.
Here are the changes:
<>
You can install it via PyPI:
pip install webob==1.x.y
Enjoy, and please report any issues you find to the issue tracker at
https://github.com/Pylons/webob/issues
Thanks!
- WebOb developers
WebOb-1.8.6/appveyor.yml 0000644 0000766 0000024 00000000640 13611742767 016100 0 ustar xistence staff 0000000 0000000 environment:
matrix:
- PYTHON: "C:\\Python35"
TOXENV: "py35"
- PYTHON: "C:\\Python27"
TOXENV: "py27"
- PYTHON: "C:\\Python27-x64"
TOXENV: "py27"
- PYTHON: "C:\\Python35-x64"
TOXENV: "py35"
cache:
- '%LOCALAPPDATA%\pip\Cache'
version: '{branch}.{build}'
install:
- "%PYTHON%\\python.exe -m pip install tox"
build: off
test_script:
- "%PYTHON%\\Scripts\\tox.exe"
WebOb-1.8.6/contributing.md 0000644 0000766 0000024 00000007347 13204653630 016540 0 ustar xistence staff 0000000 0000000 Contributing
============
All projects under the Pylons Projects, including this one, follow the
guidelines established at [How to
Contribute](http://www.pylonsproject.org/community/how-to-contribute) and
[Coding Style and
Standards](http://docs.pylonsproject.org/en/latest/community/codestyle.html).
You can contribute to this project in several ways.
* [File an Issue on GitHub](https://github.com/Pylons/webob/issues)
* Fork this project and create a branch with your suggested change. When ready,
submit a pull request for consideration. [GitHub
Flow](https://guides.github.com/introduction/flow/index.html) describes the
workflow process and why it's a good practice.
* Join the IRC channel #pyramid on irc.freenode.net.
Git Branches
------------
Git branches and their purpose and status at the time of this writing are
listed below.
* [master](https://github.com/Pylons/webob/) - The branch on which further
development takes place. The default branch on GitHub.
* [1.6-branch](https://github.com/Pylons/webob/tree/1.6-branch) - The branch
classified as "stable" or "latest". Actively maintained.
* [1.5-branch](https://github.com/Pylons/webob/tree/1.5-branch) - The oldest
actively maintained and stable branch.
Older branches are not actively maintained. In general, two stable branches and
one or two development branches are actively maintained.
Running Tests
-------------
*Note:* This section needs better instructions.
Run `tox` from within your checkout. This will run the tests across all
supported systems and attempt to build the docs.
To run the tests for Python 2.x only:
$ tox py2-cover
To build the docs for Python 3.x only:
$ tox py3-docs
See the `tox.ini` file for details.
Building documentation for a Pylons Project project
---------------------------------------------------
*Note:* These instructions might not work for Windows users. Suggestions to
improve the process for Windows users are welcome by submitting an issue or a
pull request.
1. Fork the repo on GitHub by clicking the [Fork] button.
2. Clone your fork into a workspace on your local machine.
git clone git@github.com:/webob.git
3. Add a git remote "upstream" for the cloned fork.
git remote add upstream git@github.com:Pylons/webob.git
4. Set an environment variable to your virtual environment.
# Mac and Linux
$ export VENV=~/hack-on-webob/env
# Windows
set VENV=c:\hack-on-webob\env
5. Try to build the docs in your workspace.
# Mac and Linux
$ make clean html SPHINXBUILD=$VENV/bin/sphinx-build
# Windows
c:\> make clean html SPHINXBUILD=%VENV%\bin\sphinx-build
If successful, then you can make changes to the documentation. You can
load the built documentation in the `/_build/html/` directory in a web
browser.
6. From this point forward, follow the typical [git
workflow](https://help.github.com/articles/what-is-a-good-git-workflow/).
Start by pulling from the upstream to get the most current changes.
git pull upstream master
7. Make a branch, make changes to the docs, and rebuild them as indicated in
step 5. To speed up the build process, you can omit `clean` from the above
command to rebuild only those pages that depend on the files you have
changed.
8. Once you are satisfied with your changes and the documentation builds
successfully without errors or warnings, then git commit and push them to
your "origin" repository on GitHub.
git commit -m "commit message"
git push -u origin --all # first time only, subsequent can be just 'git push'.
9. Create a [pull request](https://help.github.com/articles/using-pull-requests/).
10. Repeat the process starting from Step 6. WebOb-1.8.6/docs/ 0000755 0000766 0000024 00000000000 13611756053 014431 5 ustar xistence staff 0000000 0000000 WebOb-1.8.6/docs/Makefile 0000644 0000766 0000024 00000016355 13157035764 016107 0 ustar xistence staff 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/WebOb.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/WebOb.qhc"
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/WebOb"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/WebOb"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
WebOb-1.8.6/docs/_static/ 0000755 0000766 0000024 00000000000 13611756053 016057 5 ustar xistence staff 0000000 0000000 WebOb-1.8.6/docs/_static/.empty 0000644 0000766 0000024 00000000000 13157035764 017210 0 ustar xistence staff 0000000 0000000 WebOb-1.8.6/docs/api/ 0000755 0000766 0000024 00000000000 13611756053 015202 5 ustar xistence staff 0000000 0000000 WebOb-1.8.6/docs/api/client.txt 0000644 0000766 0000024 00000000337 13157035764 017230 0 ustar xistence staff 0000000 0000000 :mod:`webob.client` -- Send WSGI requests over HTTP
===================================================
.. automodule:: webob.client
Client
------
.. autoclass:: SendRequest
:members:
.. autoclass:: send_request_app
WebOb-1.8.6/docs/api/cookies.txt 0000644 0000766 0000024 00000000551 13611746633 017403 0 ustar xistence staff 0000000 0000000 :mod:`webob.cookies` -- Cookies
===============================
Cookies
-------
.. autoclass:: webob.cookies.CookieProfile
:members:
.. autoclass:: webob.cookies.SignedCookieProfile
:members:
.. autoclass:: webob.cookies.SignedSerializer
:members:
.. autoclass:: webob.cookies.JSONSerializer
:members:
.. autofunction:: webob.cookies.make_cookie
WebOb-1.8.6/docs/api/dec.txt 0000644 0000766 0000024 00000000236 13157035764 016503 0 ustar xistence staff 0000000 0000000 :mod:`webob.dec` -- WSGIfy decorator
====================================
.. automodule:: webob.dec
Decorator
---------
.. autoclass:: wsgify
:members:
WebOb-1.8.6/docs/api/exceptions.txt 0000644 0000766 0000024 00000004277 13157035764 020142 0 ustar xistence staff 0000000 0000000 :mod:`webob.exc` -- WebOb Exceptions
====================================
.. automodule:: webob.exc
HTTP Exceptions
---------------
.. autoexception:: HTTPException
.. autoexception:: WSGIHTTPException
.. autoexception:: HTTPError
.. autoexception:: HTTPRedirection
.. autoexception:: HTTPOk
.. autoexception:: HTTPCreated
.. autoexception:: HTTPAccepted
.. autoexception:: HTTPNonAuthoritativeInformation
.. autoexception:: HTTPNoContent
.. autoexception:: HTTPResetContent
.. autoexception:: HTTPPartialContent
.. autoexception:: _HTTPMove
.. autoexception:: HTTPMultipleChoices
.. autoexception:: HTTPMovedPermanently
.. autoexception:: HTTPFound
.. autoexception:: HTTPSeeOther
.. autoexception:: HTTPNotModified
.. autoexception:: HTTPUseProxy
.. autoexception:: HTTPTemporaryRedirect
.. autoexception:: HTTPClientError
.. autoexception:: HTTPBadRequest
.. autoexception:: HTTPUnauthorized
.. autoexception:: HTTPPaymentRequired
.. autoexception:: HTTPForbidden
.. autoexception:: HTTPNotFound
.. autoexception:: HTTPMethodNotAllowed
.. autoexception:: HTTPNotAcceptable
.. autoexception:: HTTPProxyAuthenticationRequired
.. autoexception:: HTTPRequestTimeout
.. autoexception:: HTTPConflict
.. autoexception:: HTTPGone
.. autoexception:: HTTPLengthRequired
.. autoexception:: HTTPPreconditionFailed
.. autoexception:: HTTPRequestEntityTooLarge
.. autoexception:: HTTPRequestURITooLong
.. autoexception:: HTTPUnsupportedMediaType
.. autoexception:: HTTPRequestRangeNotSatisfiable
.. autoexception:: HTTPExpectationFailed
.. autoexception:: HTTPUnprocessableEntity
.. autoexception:: HTTPLocked
.. autoexception:: HTTPFailedDependency
.. autoexception:: HTTPPreconditionRequired
.. autoexception:: HTTPTooManyRequests
.. autoexception:: HTTPRequestHeaderFieldsTooLarge
.. autoexception:: HTTPUnavailableForLegalReasons
.. autoexception:: HTTPServerError
.. autoexception:: HTTPInternalServerError
.. autoexception:: HTTPNotImplemented
.. autoexception:: HTTPBadGateway
.. autoexception:: HTTPServiceUnavailable
.. autoexception:: HTTPGatewayTimeout
.. autoexception:: HTTPVersionNotSupported
.. autoexception:: HTTPInsufficientStorage
.. autoexception:: HTTPNetworkAuthenticationRequired
.. autoexception:: HTTPExceptionMiddleware
WebOb-1.8.6/docs/api/multidict.txt 0000644 0000766 0000024 00000002471 13204653630 017740 0 ustar xistence staff 0000000 0000000 :mod:`webob.multidict` -- multi-value dictionary object
=======================================================
multidict
---------
Several parts of WebOb use a "multidict", which is a dictionary where a key can
have multiple values. The quintessential example is a query string like
``?pref=red&pref=blue``. The ``pref`` variable has two values, ``red`` and
``blue``.
In a multidict, when you do ``request.GET['pref']``, you'll get back only
``'blue'`` (the last value of ``pref``). Sometimes returning a string and
other times returning a list is a cause of frequent exceptions. If you want
*all* the values back, use ``request.GET.getall('pref')``. If you want to be
sure there is *one and only one* value, use ``request.GET.getone('pref')``,
which will raise an exception if there is zero or more than one value for
``pref``.
When you use operations like ``request.GET.items()``, you'll get back something
like ``[('pref', 'red'), ('pref', 'blue')]``. All the key/value pairs will
show up. Similarly ``request.GET.keys()`` returns ``['pref', 'pref']``.
Multidict is a view on a list of tuples; all the keys are ordered, and all the
values are ordered.
.. automodule:: webob.multidict
.. autoclass:: MultiDict
:members:
:inherited-members:
.. autoclass:: NestedMultiDict
:members:
.. autoclass:: NoVars
:members:
WebOb-1.8.6/docs/api/request.txt 0000644 0000766 0000024 00000000315 13157035764 017436 0 ustar xistence staff 0000000 0000000 :mod:`webob.request` -- Request
===============================
Request
-------
.. automodule:: webob.request
.. autoclass:: webob.request.Request
.. autoclass:: webob.request.BaseRequest
:members:
WebOb-1.8.6/docs/api/response.txt 0000644 0000766 0000024 00000000440 13157035764 017603 0 ustar xistence staff 0000000 0000000 :mod:`webob.response` -- Response
=================================
Response
--------
.. automodule:: webob.response
.. autoclass:: webob.response.Response
:members:
.. autoclass:: webob.response.ResponseBodyFile
:members:
.. autoclass:: webob.response.AppIterRange
:members:
WebOb-1.8.6/docs/api/static.txt 0000644 0000766 0000024 00000000341 13157035764 017234 0 ustar xistence staff 0000000 0000000 :mod:`webob.static` -- Serving static files
===========================================
.. automodule:: webob.static
.. autoclass:: webob.static.FileApp
:members:
.. autoclass:: webob.static.DirectoryApp
:members:
WebOb-1.8.6/docs/api/webob.txt 0000644 0000766 0000024 00000011243 13372142442 017035 0 ustar xistence staff 0000000 0000000 :mod:`webob` -- Request/Response objects
========================================
Headers
-------
.. _acceptheader:
Accept*
~~~~~~~
.. automodule:: webob.acceptparse
Convenience functions to automatically create the appropriate header objects of
a certain type:
.. autofunction:: create_accept_header
.. autofunction:: create_accept_charset_header
.. autofunction:: create_accept_encoding_header
.. autofunction:: create_accept_language_header
The classes that may be returned by one of the functions above, and their
methods:
.. autoclass:: Accept
:members: parse
.. autoclass:: AcceptOffer
:members: __str__
.. autoclass:: AcceptValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality
.. autoclass:: AcceptNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality
.. autoclass:: AcceptInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality
.. autoclass:: AcceptCharset
:members: parse
.. autoclass:: AcceptCharsetValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptCharsetNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptCharsetInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptEncoding
:members: parse
.. autoclass:: AcceptEncodingValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptEncodingNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptEncodingInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality
.. autoclass:: AcceptLanguage
:members: parse
.. autoclass:: AcceptLanguageValidHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality
.. autoclass:: AcceptLanguageNoHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality
.. autoclass:: AcceptLanguageInvalidHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality
Deprecated:
.. autoclass:: MIMEAccept
Cache-Control
~~~~~~~~~~~~~
.. autoclass:: webob.cachecontrol.CacheControl
:members:
Range and related headers
~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: webob.byterange.Range
:members:
.. autoclass:: webob.byterange.ContentRange
:members:
.. autoclass:: webob.etag.IfRange
:members:
ETag
~~~~
.. autoclass:: webob.etag.ETagMatcher
:members:
Misc Functions and Internals
----------------------------
.. autofunction:: webob.html_escape
.. comment:
not sure what to do with these constants; not autoclass
.. autoclass:: webob.day
.. autoclass:: webob.week
.. autoclass:: webob.hour
.. autoclass:: webob.minute
.. autoclass:: webob.second
.. autoclass:: webob.month
.. autoclass:: webob.year
.. autoclass:: webob.headers.ResponseHeaders
:members:
.. autoclass:: webob.headers.EnvironHeaders
:members:
.. autoclass:: webob.cachecontrol.UpdateDict
:members:
.. comment:
Descriptors
-----------
.. autoclass:: webob.descriptors.environ_getter
.. autoclass:: webob.descriptors.header_getter
.. autoclass:: webob.descriptors.converter
.. autoclass:: webob.descriptors.deprecated_property
WebOb-1.8.6/docs/changes.txt 0000644 0000766 0000024 00000000164 13157035764 016607 0 ustar xistence staff 0000000 0000000 .. _changelog:
WebOb Change History
====================
.. include:: ../CHANGES.txt
.. include:: ../HISTORY.txt
WebOb-1.8.6/docs/comment-example-code/ 0000755 0000766 0000024 00000000000 13611756053 020434 5 ustar xistence staff 0000000 0000000 WebOb-1.8.6/docs/comment-example-code/example.py 0000644 0000766 0000024 00000011747 13157035764 022457 0 ustar xistence staff 0000000 0000000 import os
import urllib
import time
import re
from cPickle import load, dump
from webob import Request, Response, html_escape
from webob import exc
class Commenter(object):
def __init__(self, app, storage_dir):
self.app = app
self.storage_dir = storage_dir
if not os.path.exists(storage_dir):
os.makedirs(storage_dir)
def __call__(self, environ, start_response):
req = Request(environ)
if req.path_info_peek() == '.comments':
return self.process_comment(req)(environ, start_response)
# This is the base path of *this* middleware:
base_url = req.application_url
resp = req.get_response(self.app)
if resp.content_type != 'text/html' or resp.status_code != 200:
# Not an HTML response, we don't want to
# do anything to it
return resp(environ, start_response)
# Make sure the content isn't gzipped:
resp.decode_content()
comments = self.get_data(req.url)
body = resp.body
body = self.add_to_end(body, self.format_comments(comments))
body = self.add_to_end(body, self.submit_form(base_url, req))
resp.body = body
return resp(environ, start_response)
def get_data(self, url):
# Double-quoting makes the filename safe
filename = self.url_filename(url)
if not os.path.exists(filename):
return []
else:
f = open(filename, 'rb')
data = load(f)
f.close()
return data
def save_data(self, url, data):
filename = self.url_filename(url)
f = open(filename, 'wb')
dump(data, f)
f.close()
def url_filename(self, url):
return os.path.join(self.storage_dir, urllib.quote(url, ''))
_end_body_re = re.compile(r'', re.I|re.S)
def add_to_end(self, html, extra_html):
"""
Adds extra_html to the end of the html page (before