summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--repoze/bfg/tests/test_traversal.py10
-rw-r--r--repoze/bfg/traversal.py12
-rw-r--r--repoze/bfg/urldispatch.py3
3 files changed, 6 insertions, 19 deletions
diff --git a/repoze/bfg/tests/test_traversal.py b/repoze/bfg/tests/test_traversal.py
index 36429222e..c81665ab1 100644
--- a/repoze/bfg/tests/test_traversal.py
+++ b/repoze/bfg/tests/test_traversal.py
@@ -90,7 +90,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], policy.root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_pathel_with_no_getitem(self):
policy = self._makeOne(None)
@@ -102,7 +101,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], policy.root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_withconn_getitem_emptypath_nosubpath(self):
root = DummyContext()
@@ -115,7 +113,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_withconn_getitem_withpath_nosubpath(self):
foo = DummyContext()
@@ -129,7 +126,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [u'foo'])
self.assertEqual(result['virtual_root'], root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_withconn_getitem_withpath_withsubpath(self):
foo = DummyContext()
@@ -143,7 +139,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [u'foo'])
self.assertEqual(result['virtual_root'], root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_with_explicit_viewname(self):
foo = DummyContext()
@@ -157,7 +152,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], root)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], None)
def test_call_with_vh_root(self):
environ = self._getEnviron(PATH_INFO='/baz',
@@ -178,7 +172,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [u'foo', u'bar', u'baz'])
self.assertEqual(result['virtual_root'], bar)
self.assertEqual(result['virtual_root_path'], [u'foo', u'bar'])
- self.assertEqual(result['matchdict'], None)
def test_non_utf8_path_segment_unicode_path_segments_fails(self):
foo = DummyContext()
@@ -208,7 +201,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], model)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], {})
def test_withroute_with_subpath(self):
model = DummyContext()
@@ -221,7 +213,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], model)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], {'subpath':'/a/b/c'})
def test_withroute_and_traverse(self):
model = DummyContext()
@@ -234,7 +225,6 @@ class ModelGraphTraverserTests(unittest.TestCase):
self.assertEqual(result['traversed'], [])
self.assertEqual(result['virtual_root'], model)
self.assertEqual(result['virtual_root_path'], [])
- self.assertEqual(result['matchdict'], {'traverse':'foo/bar'})
class FindInterfaceTests(unittest.TestCase):
def _callFUT(self, context, iface):
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py
index 350c1098f..576679853 100644
--- a/repoze/bfg/traversal.py
+++ b/repoze/bfg/traversal.py
@@ -493,7 +493,6 @@ class ModelGraphTraverser(object):
self.root = root
def __call__(self, environ, _marker=_marker):
- matchdict = None
if 'bfg.routes.matchdict' in environ:
matchdict = environ['bfg.routes.matchdict']
path = matchdict.get('traverse', '/')
@@ -528,22 +527,19 @@ class ModelGraphTraverser(object):
if segment[:2] =='@@':
return dict(context=ob, view_name=segment[2:], subpath=path[i:],
traversed=traversed, virtual_root=vroot,
- virtual_root_path=vroot_path, root=self.root,
- matchdict=matchdict)
+ virtual_root_path=vroot_path, root=self.root)
try:
getitem = ob.__getitem__
except AttributeError:
return dict(context=ob, view_name=segment, subpath=path[i:],
traversed=traversed, virtual_root=vroot,
- virtual_root_path=vroot_path, root=self.root,
- matchdict=matchdict)
+ virtual_root_path=vroot_path, root=self.root)
try:
next = getitem(segment)
except KeyError:
return dict(context=ob, view_name=segment, subpath=path[i:],
traversed=traversed, virtual_root=vroot,
- virtual_root_path=vroot_path, root=self.root,
- matchdict=matchdict)
+ virtual_root_path=vroot_path, root=self.root)
if vroot_idx == i-1:
vroot = ob
traversed.append(segment)
@@ -553,7 +549,7 @@ class ModelGraphTraverser(object):
return dict(context=ob, view_name=u'', subpath=subpath,
traversed=traversed, virtual_root=vroot,
virtual_root_path=vroot_path,
- root=self.root, matchdict=matchdict)
+ root=self.root)
class TraversalContextURL(object):
""" The IContextURL adapter used to generate URLs for a context
diff --git a/repoze/bfg/urldispatch.py b/repoze/bfg/urldispatch.py
index dcd4af208..591a91c57 100644
--- a/repoze/bfg/urldispatch.py
+++ b/repoze/bfg/urldispatch.py
@@ -37,7 +37,6 @@ class RoutesRootFactory(Mapper):
args = None
if isinstance(args, dict): # might be an empty dict
args = args.copy()
- routepath = route.routepath
config = request_config()
config.mapper = self
config.mapper_dict = args
@@ -47,6 +46,8 @@ class RoutesRootFactory(Mapper):
environ['wsgiorg.routing_args'] = ((), args)
environ['bfg.routes.route'] = route
environ['bfg.routes.matchdict'] = args
+ adhoc_attrs = environ.setdefault('webob.adhoc_attrs', {})
+ adhoc_attrs['matchdict'] = args
# this is stolen from routes.middleware; if the route map
# has a *path_info capture, use it to influence the path
# info and script_name of the generated environment