diff options
| author | Fernando Correa Neto <fcdoth@gmail.com> | 2008-12-09 23:16:56 +0000 |
|---|---|---|
| committer | Fernando Correa Neto <fcdoth@gmail.com> | 2008-12-09 23:16:56 +0000 |
| commit | 67b8a1ceda0d73739b18045c8b405a1d22b4480a (patch) | |
| tree | ba340a43cfd0f030833b8714137f7439bbb45feb /repoze/bfg/traversal.py | |
| parent | d1925330a4b9c9fae0ac28025b5c1023a0a5c0a6 (diff) | |
| download | pyramid-67b8a1ceda0d73739b18045c8b405a1d22b4480a.tar.gz pyramid-67b8a1ceda0d73739b18045c8b405a1d22b4480a.tar.bz2 pyramid-67b8a1ceda0d73739b18045c8b405a1d22b4480a.zip | |
Add context.root to router so the root model can be easily accessed from a view
Diffstat (limited to 'repoze/bfg/traversal.py')
| -rw-r--r-- | repoze/bfg/traversal.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py index 4c5bb930d..61b66c040 100644 --- a/repoze/bfg/traversal.py +++ b/repoze/bfg/traversal.py @@ -66,7 +66,10 @@ class ModelGraphTraverser(object): def find_root(model): """ Find the root node in the graph to which ``model`` - belongs. Note that ``model`` should be :term:`location`-aware.""" + belongs. Note that ``model`` should be :term:`location`-aware. + Note that the root node is available in the request object by + accessing the ``request.root`` attribute. + """ for location in lineage(model): if location.__parent__ is None: model = location |
