diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-11-19 02:21:37 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-11-19 02:21:37 +0000 |
| commit | 65dcf305794feffb1da33c15b5af8d4964580d72 (patch) | |
| tree | 0ebad53fed1b951458aabda0741e71bcaeb4a17d /repoze/bfg/traversal.py | |
| parent | 5483348a58f8c3adcc2dec7b2e6b188a588c04cf (diff) | |
| download | pyramid-65dcf305794feffb1da33c15b5af8d4964580d72.tar.gz pyramid-65dcf305794feffb1da33c15b5af8d4964580d72.tar.bz2 pyramid-65dcf305794feffb1da33c15b5af8d4964580d72.zip | |
- Fix ModelGraphTraverser; don't try to change the ``__name__`` or
``__parent__`` of an object that claims it implements ILocation
during traversal even if the ``__name__`` or ``__parent__`` of the
object traversed does not match the name used in the traversal
step or the or the traversal parent . Rationale: it was insane to
do so. This bug was only found due to a misconfiguration in an
application that mistakenly had intermediate persistent
non-ILocation objects; traversal was causing a persistent write on
every request under this setup.
- ``repoze.bfg.location.locate`` now unconditionally sets
``__name__`` and ``__parent__`` on objects which provide ILocation
(it previously only set them conditionally if they didn't match
attributes already present on the object via equality).
Prep for 0.5.0.
Diffstat (limited to 'repoze/bfg/traversal.py')
| -rw-r--r-- | repoze/bfg/traversal.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py index 8c2df6a41..f6a415b85 100644 --- a/repoze/bfg/traversal.py +++ b/repoze/bfg/traversal.py @@ -3,7 +3,7 @@ import urlparse from zope.interface import classProvides from zope.interface import implements -from repoze.bfg.location import locate +from repoze.bfg.location import LocationProxy from repoze.bfg.location import lineage from repoze.bfg.interfaces import ILocation @@ -48,9 +48,8 @@ class ModelGraphTraverser(object): def __call__(self, environ): path = environ.get('PATH_INFO', '/') path = split_path(path) - root = self.root - ob = self.root + name = '' while path: @@ -59,8 +58,8 @@ class ModelGraphTraverser(object): if next is _marker: name = segment break - if self.locatable: - next = locate(next, ob, segment) + if (self.locatable) and (not ILocation.providedBy(next)): + next = LocationProxy(next, ob, segment) ob = next return ob, name, path |
