summaryrefslogtreecommitdiff
path: root/docs/narr/urldispatch.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-10-30 19:38:41 +0000
committerChris McDonough <chrism@agendaless.com>2009-10-30 19:38:41 +0000
commitacc7765a037983907d3275312396ee10b6b9ad2e (patch)
treedc91f45c5b638f6c86ec9c74b627e37251707d7c /docs/narr/urldispatch.rst
parent11644e705834ff65cb8963333855a1db6272ae1e (diff)
downloadpyramid-acc7765a037983907d3275312396ee10b6b9ad2e.tar.gz
pyramid-acc7765a037983907d3275312396ee10b6b9ad2e.tar.bz2
pyramid-acc7765a037983907d3275312396ee10b6b9ad2e.zip
- The ``__call__`` of a plugin "traverser" implementation (registered
as an adapter for ``ITraverser`` or ``ITraverserFactory``) will now receive a *request* as the single argument to its ``__call__`` method. In previous versions it was passed a WSGI ``environ`` object. The request object passed to the factory implements dictionary-like methods in such a way that existing traverser code which expects to be passed an environ will continue to work. - Fix docs.
Diffstat (limited to 'docs/narr/urldispatch.rst')
-rw-r--r--docs/narr/urldispatch.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 7a2a184f7..26d4b4a93 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -472,7 +472,7 @@ dispatch will by default be an instance of the object returned by the
default :term:`root factory`. You can override this behavior by
passing in a ``factory`` argument to the ZCML directive for a
particular route. The ``factory`` should be a callable that accepts a
-WSGI environment and returns an instance of a class that will be the
+:term:`request` and returns an instance of a class that will be the
context used by the view.
An example of using a route with a factory:
@@ -489,7 +489,7 @@ An example of using a route with a factory:
The above route will manufacture an ``Idea`` model as a context,
assuming that ``mypackage.models.Idea`` resolves to a class that
-accepts a WSGI environment in its ``__init__``.
+accepts a request in its ``__init__``.
.. note:: Values prefixed with a period (``.``) for the ``factory``
and ``view`` attributes of a ``route`` (such as ``.models.Idea``
@@ -536,8 +536,8 @@ The ``.models`` module referred to above might look like so:
:linenos:
class Article(object):
- def __init__(self, environ):
- self.__dict__.update(environ['bfg.routes.matchdict'])
+ def __init__(self, request):
+ self.__dict__.update(request.matchdict)
def is_root(self):
return self.article == 'root'
@@ -739,8 +739,8 @@ Such a ``factory`` might look like so:
:linenos:
class Article(object):
- def __init__(self, environ):
- matchdict = environ['bfg.routes.matchdict']
+ def __init__(self, request):
+ matchdict = request.matchdict
article = matchdict.get('article', None)
if article == '1':
self.__acl__ = [ (Allow, 'editor', 'view') ]