summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2017-10-29 19:32:58 -0700
committerBert JW Regeer <xistence@0x58.com>2017-10-29 20:32:58 -0600
commit41f362b5c052197d95436dbc01a28f5a0f56a403 (patch)
tree753a230150157e88ca5a6da46cd3cb19cc6e1872 /docs
parent7500b1410efdf49ed79e1bcc29a19da0dd5c272e (diff)
downloadwebob-41f362b5c052197d95436dbc01a28f5a0f56a403.tar.gz
Update and fix links per `make linkcheck` (#334)
* update intersphinx mapping for latest python * update links to python PEP333 and datetime * update links per make linkcheck * update links per make linkcheck - pythonpaste.org has been down since 2016-11-09 https://bitbucket.org/ianb/paste/issues/20/pythonpasteorg-is-down
Diffstat (limited to 'docs')
-rw-r--r--docs/comment-example.txt6
-rw-r--r--docs/conf.py3
-rw-r--r--docs/differences.txt26
-rw-r--r--docs/do-it-yourself.txt16
-rw-r--r--docs/index.txt13
-rw-r--r--docs/jsonrpc-example.txt22
-rw-r--r--docs/reference.txt18
-rw-r--r--docs/wiki-example.txt14
8 files changed, 56 insertions, 62 deletions
diff --git a/docs/comment-example.txt b/docs/comment-example.txt
index e108382..21377ac 100644
--- a/docs/comment-example.txt
+++ b/docs/comment-example.txt
@@ -48,7 +48,7 @@ When you use this middleware, you'll use it like:
app = Commenter(app, storage_dir='./comments')
For our application we'll use a simple static file server that is
-included with `Paste <http://pythonpaste.org>`_ (use ``easy_install
+included with `Paste <https://bitbucket.org/ianb/paste/>`_ (use ``easy_install
Paste`` to install this). The setup is all at the bottom of
``example.py``, and looks like this:
@@ -249,10 +249,10 @@ and just turns ``&`` into ``&amp;``, etc.
Because we put in some text without quoting it is susceptible to a
`Cross-Site Scripting
-<http://en.wikipedia.org/wiki/Cross-site_scripting>`_ attack. Fixing
+<https://en.wikipedia.org/wiki/Cross-site_scripting>`_ attack. Fixing
that is beyond the scope of this tutorial; you could quote it or clean
it with something like `lxml.html.clean
-<http://codespeak.net/lxml/lxmlhtml.html#cleaning-up-html>`_.
+<http://lxml.de/lxmlhtml.html#cleaning-up-html>`_.
Accepting Comments
------------------
diff --git a/docs/conf.py b/docs/conf.py
index 1e51b20..9cba5c8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -154,6 +154,5 @@ epub_exclude_files = ['search.html']
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
- 'python': ('https://docs.python.org', None),
- 'python3': ('https://docs.python.org/3', None),
+ 'python': ('https://docs.python.org/3', None),
}
diff --git a/docs/differences.txt b/docs/differences.txt
index fd2ce39..b7f9638 100644
--- a/docs/differences.txt
+++ b/docs/differences.txt
@@ -71,7 +71,7 @@ Django
======
This is a quick summary from reading `the Django documentation
-<http://www.djangoproject.com/documentation/request_response/>`_.
+<https://docs.djangoproject.com/en/1.11/ref/request-response/>`_.
Request
-------
@@ -183,7 +183,7 @@ CherryPy/TurboGears
===================
The `CherryPy request object
-<http://www.cherrypy.org/wiki/RequestObject>`_ is also used by
+<https://bitbucket.org/cherrypy/cherrypy/wiki/CherryPySpec>`_ is also used by
TurboGears 1.x.
Request
@@ -284,7 +284,7 @@ Response
--------
From information `from the wiki
-<http://www.cherrypy.org/wiki/ResponseObject>`_.
+<https://bitbucket.org/cherrypy/cherrypy/wiki/CherryPySpec>`_.
``body``:
This is an iterable in CherryPy, a string in WebOb;
@@ -321,7 +321,7 @@ From information `from the wiki
Yaro
====
-`Yaro <http://lukearno.com/projects/yaro/>`_ is a small wrapper around
+`Yaro <https://pypi.python.org/pypi/yaro>`_ is a small wrapper around
the WSGI environment, much like WebOb in scope.
The WebOb objects have many more methods and attributes. The Yaro
@@ -361,11 +361,11 @@ Request
Werkzeug
========
-An offshoot of `Pocoo <http://pocoo.org>`_,
+An offshoot of `Pocoo <http://www.pocoo.org/>`_,
this library is based around WSGI, similar to Paste and Yaro.
This is taken from the `wrapper documentation
-<http://werkzeug.pocoo.org/documentation/wrappers>`_.
+<http://werkzeug.pocoo.org/docs/0.12/wrappers/>`_.
Request
-------
@@ -397,9 +397,9 @@ Zope 3
======
From the Zope 3 interfaces for the `Request
-<http://apidoc.zope.org/++apidoc++/Interface/zope.publisher.interfaces.browser.IBrowserRequest/index.html>`_
+<https://zopepublisher.readthedocs.io/en/sphinx-docs/browser_api.html#zope.publisher.interfaces.browser.IBrowserRequest>`_
and `Response
-<http://apidoc.zope.org/++apidoc++/Interface/zope.publisher.interfaces.http.IHTTPResponse/index.html>`_.
+<http://zopepublisher.readthedocs.io/en/sphinx-docs/http_api.html#zope.publisher.interfaces.http.IHTTPResponse>`_.
Request
-------
@@ -542,7 +542,7 @@ mod_python
==========
Some key attributes from the `mod_python
-<http://modpython.org/live/current/doc-html/pyapi-mprequest-mem.html>`_
+<http://modpython.org/live/current/doc-html/pythonapi.html#request-members>`_
request object.
Request
@@ -585,8 +585,11 @@ Response
webapp Response
===============
+.. note:: Google App Engine released the successor to webapp, `webapp2
+ <https://cloud.google.com/appengine/docs/standard/python/tools/webapp2>`_.
+
The Google App Engine `webapp
-<http://code.google.com/appengine/docs/python/tools/webapp/>`_
+<https://cloud.google.com/appengine/docs/standard/python/tools/webapp/>`_
framework uses the WebOb Request object, but does not use its Response
object.
@@ -619,8 +622,7 @@ while the WebOb response does not set any cache headers.
write to ``resp.body_file``, but it does not allow unicode.
Besides exposing a ``.headers`` attribute (based on
-`wsgiref.headers.Headers
-<http://docs.python.org/library/wsgiref.html#wsgiref.headers.Headers>`_)
+:py:class:`wsgiref.headers.Headers`)
there is no other API for the webapp response object. This means the
response lacks:
diff --git a/docs/do-it-yourself.txt b/docs/do-it-yourself.txt
index e88bbab..e92bd2e 100644
--- a/docs/do-it-yourself.txt
+++ b/docs/do-it-yourself.txt
@@ -6,7 +6,7 @@ Another Do-It-Yourself Framework
Introduction and Audience
-------------------------
-It's been over two years since I wrote the `first version of this tutorial <http://pythonpaste.org/do-it-yourself-framework.html>`_. I decided to give it another run with some of the tools that have come about since then (particularly `WebOb <http://webob.org/>`_).
+It's been over two years since I wrote the `first version of this tutorial <https://bitbucket.org/ianb/paste/src/0e5a48796ab969d874c6b772c5c33561ac2d1b0d/docs/do-it-yourself-framework.txt?at=default&fileviewer=file-view-default>`_. I decided to give it another run with some of the tools that have come about since then (particularly `WebOb <https://webob.org/>`_).
Sometimes Python is accused of having too many web frameworks. And it's true, there are a lot. That said, I think writing a framework is a useful exercise. It doesn't let you skip over too much without understanding it. It removes the magic. So even if you go on to use another existing framework (which I'd probably advise you do), you'll be able to understand it better if you've written something like it on your own.
@@ -84,7 +84,7 @@ These two pieces solve a lot of the more tedious parts of making a framework. T
Serving Your Application
------------------------
-While we can test the application using WebOb, you might want to serve the application. Here's the basic recipe, using the `Paste <http://pythonpaste.org>`_ HTTP server:
+While we can test the application using WebOb, you might want to serve the application. Here's the basic recipe, using the `Paste <https://pypi.python.org/pypi/Paste>`_ HTTP server:
.. code-block:: python
@@ -92,7 +92,7 @@ While we can test the application using WebOb, you might want to serve the appli
from paste import httpserver
httpserver.serve(app, host='127.0.0.1', port=8080)
-you could also use `wsgiref <https://docs.python.org/3/library/wsgiref.html#module-wsgiref.simple_server>`_ from the standard library, but this is mostly appropriate for testing as it is single-threaded:
+You could also use :py:mod:`wsgiref.simple_server` from the standard library, but this is mostly appropriate for testing as it is single-threaded:
.. code-block:: python
@@ -188,7 +188,7 @@ To do the matching, we'll compile those templates to regular expressions.
**line 19**: And then we make the regular expression match the complete string (``^`` to force it to match from the start, ``$`` to make sure it matches up to the end).
-To test it we can try some translations. You could put these directly in the docstring of the ``template_to_regex`` function and use `doctest <http://python.org/doc/current/lib/module-doctest.html>`_ to test that. But I'm using doctest to test *this* document, so I can't put a docstring doctest inside the doctest itself. Anyway, here's what a test looks like:
+To test it we can try some translations. You could put these directly in the docstring of the ``template_to_regex`` function and use :py:mod:`doctest` to test that. But I'm using doctest to test *this* document, so I can't put a docstring doctest inside the doctest itself. Anyway, here's what a test looks like:
.. code-block:: python
@@ -268,7 +268,7 @@ Controllers
The router just passes the request on to the controller, so the controllers are themselves just WSGI applications. But we'll want to set up something to make those applications friendlier to write.
-To do that we'll write a `decorator <http://www.ddj.com/web-development/184406073>`_. A decorator is a function that wraps another function. After decoration the function will be a WSGI application, but it will be decorating a function with a signature like ``controller_func(req, **urlvars)``. The controller function will return a response object (which, remember, is a WSGI application on its own).
+To do that we'll write a `decorator <http://www.drdobbs.com/web-development/python-24-decorators/184406073>`_. A decorator is a function that wraps another function. After decoration the function will be a WSGI application, but it will be decorating a function with a signature like ``controller_func(req, **urlvars)``. The controller function will return a response object (which, remember, is a WSGI application on its own).
.. code-block:: python
:linenos:
@@ -289,7 +289,7 @@ To do that we'll write a `decorator <http://www.ddj.com/web-development/18440607
**line 3**: This is the typical signature for a decorator -- it takes one function as an argument, and returns a wrapped function.
-**line 4**: This is the replacement function we'll return. This is called a `closure <http://en.wikipedia.org/wiki/Closure_(computer_science)>`_ -- this function will have access to ``func``, and everytime you decorate a new function there will be a new ``replacement`` function with its own value of ``func``. As you can see, this is a WSGI application.
+**line 4**: This is the replacement function we'll return. This is called a `closure <https://en.wikipedia.org/wiki/Closure_(computer_programming)>`_ -- this function will have access to ``func``, and everytime you decorate a new function there will be a new ``replacement`` function with its own value of ``func``. As you can see, this is a WSGI application.
**line 5**: We create a request.
@@ -361,7 +361,7 @@ Another Controller
There's another pattern that might be interesting to try for a controller. Instead of a function, we can make a class with methods like ``get``, ``post``, etc. The ``urlvars`` will be used to instantiate the class.
-We could do this as a superclass, but the implementation will be more elegant as a wrapper, like the decorator is a wrapper. Python 3.0 will add `class decorators <http://www.python.org/dev/peps/pep-3129/>`_ which will work like this.
+We could do this as a superclass, but the implementation will be more elegant as a wrapper, like the decorator is a wrapper. Python 3.0 will add `class decorators <https://www.python.org/dev/peps/pep-3129/>`_ which will work like this.
We'll allow an extra ``action`` variable, which will define the method (actually ``action_method``, where ``_method`` is the request method). If no action is given, we'll use just the method (i.e., ``get``, ``post``, etc).
@@ -537,7 +537,7 @@ Well, we don't *really* need to factor templating into our framework. After all
But we'll add a little helper, because I think it shows a clever trick.
-We'll use `Tempita <http://pythonpaste.org/tempita/>`_ for templating, mostly because it's very simplistic about how it does loading. The basic form is:
+We'll use `Tempita <https://pypi.python.org/pypi/Tempita>`_ for templating, mostly because it's very simplistic about how it does loading. The basic form is:
.. code-block:: python
diff --git a/docs/index.txt b/docs/index.txt
index 25142cb..3f5376f 100644
--- a/docs/index.txt
+++ b/docs/index.txt
@@ -4,7 +4,7 @@ WebOb
+++++
WebOb provides objects for HTTP requests and responses. Specifically
-it does this by wrapping the `WSGI <http://wsgi.org>`_ request
+it does this by wrapping the `WSGI <https://wsgi.readthedocs.io/en/latest/>`_ request
environment and response status/headers/app_iter(body).
The request and response objects provide many conveniences for parsing
@@ -52,7 +52,7 @@ Request
=======
The request object is a wrapper around the `WSGI environ dictionary
-<http://www.python.org/dev/peps/pep-0333/#environ-variables>`_. This
+<https://www.python.org/dev/peps/pep-0333/#environ-variables>`_. This
dictionary contains keys for each header, keys that describe the
request (including the path and query string), a file-like object for
the request body, and a variety of custom keys. You can always access
@@ -102,8 +102,7 @@ the following:
Also for standard HTTP request headers, there are usually attributes, e.g.,
``req.accept_language``, ``req.content_length``, and ``req.user_agent``. These
properties expose the *parsed* form of each header, for whatever parsing makes
-sense. For instance, ``req.if_modified_since`` returns a `datetime
-<http://python.org/doc/current/lib/datetime-datetime.html>`_ object (or
+sense. For instance, ``req.if_modified_since`` returns a :py:class:`~datetime.datetime` object (or
``None`` if the header is was not provided). Details are in the `Request
reference <class-webob.Request.html>`_.
@@ -309,7 +308,7 @@ advanced HTTP techniques, while the `comment middleware example
<comment-example>`_ shows middleware. For applications, it's more
reasonable to use WebOb in the context of a larger framework. `Pyramid
<https://trypyramid.com>`_, and its predecessor `Pylons
-<http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/>`_,
+<https://docs.pylonsproject.org/projects/pylons-webframework/en/latest/>`_,
both use WebOb.
.. toctree::
@@ -336,10 +335,10 @@ Status and License
==================
WebOb is an extraction and refinement of pieces from `Paste
-<http://pythonpaste.org/>`_. It is under active development on `GitHub
+<https://pypi.python.org/pypi/Paste>`_. It is under active development on `GitHub
<https://github.com/pylons/webob>`_. It was originally written by `Ian Bicking
<http://www.ianbicking.org/>`_, and is maintained by the `Pylons Project
-<http://www.pylonsproject.org/>`_.
+<https://pylonsproject.org/>`_.
You can clone the source code with:
diff --git a/docs/jsonrpc-example.txt b/docs/jsonrpc-example.txt
index d037c72..c105913 100644
--- a/docs/jsonrpc-example.txt
+++ b/docs/jsonrpc-example.txt
@@ -11,21 +11,21 @@ Introduction
This is an example of how to write a web service using WebOb. The
example shows how to create a `JSON-RPC <http://json-rpc.org/>`_
endpoint using WebOb and the `simplejson
-<http://www.undefined.org/python/#simplejson>`_ JSON library. This
+<https://pypi.python.org/pypi/simplejson>`_ JSON library. This
also shows how to use WebOb as a client library using `WSGIProxy
-<http://pythonpaste.org/wsgiproxy/>`_.
+<https://pypi.python.org/pypi/WSGIProxy/>`_.
While this example presents JSON-RPC, this is not an endorsement of
JSON-RPC. In fact I don't like JSON-RPC. It's unnecessarily
un-RESTful, and modelled too closely on `XML-RPC
-<http://www.xmlrpc.com/>`_.
+<http://xmlrpc.scripting.com/>`_.
Code
----
The finished code for this is available in
`docs/json-example-code/jsonrpc.py
-<https://github.com/Pylons/webob/tree/master/docs/jsonrpc-example-code/jsonrpc.py>`_
+<https://github.com/Pylons/webob/blob/master/docs/jsonrpc-example-code/jsonrpc.py>`_
-- you can run that file as a script to try it out, or import it.
Concepts
@@ -36,7 +36,7 @@ and get the return values. It also provides a way to get error
responses.
The `specification
-<http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html>`_ goes into the
+<http://json-rpc.org/wiki/specification>`_ goes into the
details (though in a vague sort of way). Here's the basics:
* All access goes through a POST to a single URL.
@@ -76,8 +76,7 @@ Infrastructure
--------------
To make this easier to test, we'll set up a bit of infrastructure.
-This will open up a server (using `wsgiref
-<http://python.org/doc/current/lib/module-wsgiref.simpleserver.html>`_)
+This will open up a server (using :py:mod:`wsgiref.simple_server`)
and serve up our application (note that *creating* the application is
left out to start with):
@@ -536,12 +535,11 @@ Using Them Together
-------------------
Good programmers start with tests. But at least we'll end with a
-test. We'll use `doctest
-<http://python.org/doc/current/lib/module-doctest.html>`_ for our
+test. We'll use :py:mod:`doctest` for our
tests. The test is in `docs/json-example-code/test_jsonrpc.txt
-<https://github.com/Pylons/webob/tree/master/docs/jsonrpc-example-code/test_jsonrpc.txt>`_
+<https://github.com/Pylons/webob/blob/master/docs/jsonrpc-example-code/test_jsonrpc.txt>`_
and you can run it with `docs/json-example-code/test_jsonrpc.py
-<https://github.com/Pylons/webob/tree/master/docs/jsonrpc-example-code/test_jsonrpc.py>`_,
+<https://github.com/Pylons/webob/blob/master/docs/jsonrpc-example-code/test_jsonrpc.py>`_,
which looks like:
.. code-block:: python
@@ -648,6 +646,6 @@ elegance of the symmetry of the request and response objects, and the
client and server for the protocol.
Many of these techniques would be better used with a `RESTful
-<http://en.wikipedia.org/wiki/Representational_State_Transfer>`_
+<https://en.wikipedia.org/wiki/Representational_state_transfer>`_
service, so do think about that direction if you are implementing your
own protocol.
diff --git a/docs/reference.txt b/docs/reference.txt
index 76b1289..b88e908 100644
--- a/docs/reference.txt
+++ b/docs/reference.txt
@@ -11,8 +11,7 @@ Introduction
============
This document covers all the details of the Request and Response
-objects. It is written to be testable with `doctest
-<http://python.org/doc/current/lib/module-doctest.html>`_ -- this
+objects. It is written to be testable with :py:mod:`doctest` -- this
affects the flavor of the documentation, perhaps to its detriment.
But it also means you can feel confident that the documentation is
correct.
@@ -27,7 +26,7 @@ Request
=======
The primary object in WebOb is :py:class:`webob.Request`, a wrapper around a
-`WSGI environment <http://www.python.org/dev/peps/pep-0333/>`_.
+`WSGI environment <https://www.python.org/dev/peps/pep-0333/>`_.
The basic way you create a request object is simple enough:
@@ -51,9 +50,9 @@ use this exclusively of other libraries. If those other libraries
also keep their state in the environment, multiple wrappers can
coexist. Examples of libraries that can coexist include
`paste.wsgiwrappers.Request
-<http://pythonpaste.org/class-paste.wsgiwrappers.WSGIRequest.html>`_
+<https://bitbucket.org/ianb/paste/src/0e5a48796ab969d874c6b772c5c33561ac2d1b0d/paste/wsgiwrappers.py?at=default&fileviewer=file-view-default#wsgiwrappers.py-64>`_
(used by Pylons) and `yaro.Request
-<http://lukearno.com/projects/yaro/>`_.
+<https://pypi.python.org/pypi/yaro>`_.
The WSGI environment has a number of required variables. To make it
easier to test and play around with, the ``Request`` class has a
@@ -486,7 +485,7 @@ unchanged".
For more on this kind of conditional request, see `Detecting the Lost
Update Problem Using Unreserved Checkout
-<http://www.w3.org/1999/04/Editing/>`_.
+<https://www.w3.org/1999/04/Editing/>`_.
Calling WSGI Applications
-------------------------
@@ -811,8 +810,7 @@ You can also set Cache-Control related attributes with
>>> res.headers['Expires']
'... GMT'
-You can also use the `timedelta
-<http://python.org/doc/current/lib/datetime-timedelta.html>`_
+You can also use the :py:class:`~datetime.timedelta`
constants defined, e.g.:
.. code-block:: python
@@ -955,8 +953,8 @@ request will an HTML response be given:
This is taken from `paste.httpexceptions
-<http://pythonpaste.org/modules/httpexceptions.html#module-paste.httpexceptions>`_, and if
-you have Paste installed then these exceptions will be subclasses of
+<https://bitbucket.org/ianb/paste/src/0e5a48796ab969d874c6b772c5c33561ac2d1b0d/paste/httpexceptions.py?at=default&fileviewer=file-view-default#httpexceptions.py-8>`_,
+and if you have Paste installed then these exceptions will be subclasses of
the Paste exceptions.
diff --git a/docs/wiki-example.txt b/docs/wiki-example.txt
index 14956e5..1afa22d 100644
--- a/docs/wiki-example.txt
+++ b/docs/wiki-example.txt
@@ -26,7 +26,7 @@ Code
The finished code for this is available in
`docs/wiki-example-code/example.py
-<https://github.com/Pylons/webob/tree/master/docs/wiki-example-code/example.py>`_
+<https://github.com/Pylons/webob/blob/master/docs/wiki-example-code/example.py>`_
-- you can run that file as a script to try it out.
Creating an Application
@@ -88,8 +88,7 @@ interface:
There's not much to talk about in this code block. The application is
instantiated and served with the built-in module
-`wsgiref.simple_server
-<http://www.python.org/doc/current/lib/module-wsgiref.simple_server.html>`_.
+:py:mod:`wsgiref.simple_server`.
The WSGI Application
--------------------
@@ -351,9 +350,9 @@ page doesn't exist. ``exc.HTTPTemporaryRedirect`` is a response that
gives a ``307 Temporary Redirect`` response with the given location.
Otherwise we fill in a template. The template language we're going to
-use in this example is `Tempita <http://pythonpaste.org/tempita/>`_, a
+use in this example is `Tempita <https://pypi.python.org/pypi/Tempita>`_, a
very simple template language with a similar interface to
-`string.Template <http://python.org/doc/current/lib/node40.html>`_.
+:py:class:`string.Template`.
The template actually looks like this:
@@ -413,8 +412,7 @@ To allow conditional responses we set ``resp.last_modified``. You can
set this attribute to a date, None (effectively removing the header),
a time tuple (like produced by ``time.localtime()``), or as in this
case to an integer timestamp. If you get the value back it will
-always be a `datetime
-<http://python.org/doc/current/lib/datetime-datetime.html>`_ object
+always be a :py:class:`~datetime.datetime` object
(or None). With this header we can process requests with
If-Modified-Since headers, and return ``304 Not Modified`` if
appropriate. It won't actually do that unless you set
@@ -479,7 +477,7 @@ In ``<form action="{{req.path_url}}" method="POST">`` we submit to
POSTing right over the view page. This has the nice side effect of
automatically invalidating any caches of the original page. It also
is vaguely `RESTful
-<http://en.wikipedia.org/wiki/Representational_State_Transfer>`_.
+<https://en.wikipedia.org/wiki/Representational_State_Transfer>`_.
We save the last modified time in a hidden ``mtime`` field. This way
we can detect concurrent updates. If start editing the page who's