diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-01-27 22:10:55 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-01-27 22:10:55 +0000 |
| commit | 7b75a8f9f4550df6ea82e8ee2b3452d9478bdb12 (patch) | |
| tree | d79de1c391543919cb40955a0776c02907d935aa | |
| parent | e62e479e338e428f6cfd3b07790545982b7cb94f (diff) | |
| download | pyramid-7b75a8f9f4550df6ea82e8ee2b3452d9478bdb12.tar.gz pyramid-7b75a8f9f4550df6ea82e8ee2b3452d9478bdb12.tar.bz2 pyramid-7b75a8f9f4550df6ea82e8ee2b3452d9478bdb12.zip | |
Docs renderings.
| -rw-r--r-- | docs/narr/vhosting.rst | 2 | ||||
| -rw-r--r-- | repoze/bfg/traversal.py | 50 |
2 files changed, 26 insertions, 26 deletions
diff --git a/docs/narr/vhosting.rst b/docs/narr/vhosting.rst index 2cd1346e3..35bd046e7 100644 --- a/docs/narr/vhosting.rst +++ b/docs/narr/vhosting.rst @@ -12,7 +12,7 @@ needs to be done within a :mod:`repoze.bfg` application to make this work. However, :mod:`repoze.bfg` also supports "virtual roots", which can be -used in :term:`traversal` -based (but not :term:`URL-dispatch` -based) +used in :term:`traversal` -based (but not :term:`URL dispatch` -based) applications. These are explained below. Virtual Root Support diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py index e875219c1..76172c18c 100644 --- a/repoze/bfg/traversal.py +++ b/repoze/bfg/traversal.py @@ -122,30 +122,30 @@ def model_path(model, *elements): return path def virtual_root(model, request): - """ Return the model object representing the 'virtual root' of the - current request. Using a virtual root in a traversal-based - :mod:`repoze.bfg` application permits rooting, for example, the - object at the traversal path ``/cms`` at ``http://example.com/`` - instead of rooting it at ``http://example.com/cms/``. + """ + Provided any model and a request object, return the model object + representing the 'virtual root' of the current request. Using a + virtual root in a traversal-based :mod:`repoze.bfg` application + permits rooting, for example, the object at the traversal path + ``/cms`` at ``http://example.com/`` instead of rooting it at + ``http://example.com/cms/``. If the ``model`` passed in is a context obtained via - :term:`traversal`, and if the ``%s`` key is in the WSGI - environment, the value of this key will be treated as a 'virtual - root path': the :mod:``repoze.bfg.traversal.find_model`` API will - be used to find the virtual root object using this path; if the - object is found, it will found will be returned. If the ``%s`` - key is is not present in the WSGI environment, the physical + :term:`traversal`, and if the ``HTTP_X_VHM_ROOT`` key is in the + WSGI environment, the value of this key will be treated as a + 'virtual root path': the :func:`repoze.bfg.traversal.find_model` + API will be used to find the virtual root object using this path; + if the object is found, it will found will be returned. If the + ``%s`` key is is not present in the WSGI environment, the physical :term:`root` of the graph will be returned instead. - .. note:: Virtual roots are not useful in at all applications that - use :term:`URL dispatch`. Contexts obtained via URL - dispatch don't really support being virtually rooted - (each URL dispatch context is both its own physical and - virtual root). However, for symmetry, if this API is - called with a model which is a context obtained via URL - dispatch, the model passed in will be returned - unconditonally. - """ % (VH_ROOT_KEY, VH_ROOT_KEY) + Virtual roots are not useful at all in applications that use + :term:`URL dispatch`. Contexts obtained via URL dispatch don't + really support being virtually rooted (each URL dispatch context + is both its own physical and virtual root). However if this API + is called with a ``model`` argument which is a context obtained + via URL dispatch, the model passed in will be returned + unconditonally.""" urlgenerator = getMultiAdapter((model, request), IContextURL) return urlgenerator.virtual_root() @@ -286,11 +286,11 @@ class TraversalContextURL(object): unicode name, it will be converted to a UTF-8 string before being attached to the URL. When composing the path based on the model lineage, empty names in the model graph are ignored. - If a ``%s`` key is present in the WSGI environment, its value - will be treated as a 'virtual root path': the path of the URL - generated by this will be left-stripped of this virtual root - path value. - """ % VH_ROOT_KEY + If a ``HTTP_X_VHM_ROOT`` key is present in the WSGI + environment, its value will be treated as a 'virtual root + path': the path of the URL generated by this will be + left-stripped of this virtual root path value. + """ rpath = [] for location in lineage(self.context): name = location.__name__ |
