From dda6e51c35491ebb58715b67e438524f7874f0e4 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 4 Nov 2010 20:51:43 -0400 Subject: - Remove squiggly routing syntax. --- TODO.txt | 2 -- pyramid/configuration.py | 18 ------------------ pyramid/tests/test_configuration.py | 15 +++++---------- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/TODO.txt b/TODO.txt index f362ffeee..97ba06b06 100644 --- a/TODO.txt +++ b/TODO.txt @@ -95,8 +95,6 @@ - Move static dir from pkg/templates/ to /pkg/ in pyramid_* paster templates. -- Remove squiggly routing syntax. - - Use a IBeforeRender subscriber to add Pylons-paster-template renderer globals. diff --git a/pyramid/configuration.py b/pyramid/configuration.py index 936ed7b15..805894ce4 100644 --- a/pyramid/configuration.py +++ b/pyramid/configuration.py @@ -202,7 +202,6 @@ class Configurator(object): manager = manager # for testing injection venusian = venusian # for testing injection - squiggly_route_re = re.compile(r'(/{[a-zA-Z]\w*})') # for add_route def __init__(self, registry=None, @@ -1525,23 +1524,6 @@ class Configurator(object): pattern = path if pattern is None: raise ConfigurationError('"pattern" argument may not be None') - - # Support the ``/:colon`` syntax supported by BFG but also - # support the ``/{squiggly}`` segment syntax familiar to - # Pylons folks by transforming it (internally) into - # ``/:colon`` syntax. - - parts = self.squiggly_route_re.split(pattern) - npattern = [] - - for part in parts: - match = self.squiggly_route_re.match(part) - if match: - npattern.append('/:%s' % match.group()[2:-1]) - else: - npattern.append(part) - - pattern = ''.join(npattern) return mapper.connect(name, pattern, factory, predicates=predicates, pregenerator=pregenerator) diff --git a/pyramid/tests/test_configuration.py b/pyramid/tests/test_configuration.py index f41c86840..10b6e5fe7 100644 --- a/pyramid/tests/test_configuration.py +++ b/pyramid/tests/test_configuration.py @@ -1784,7 +1784,7 @@ class ConfiguratorTests(unittest.TestCase): def dummy_add_view(**kw): views.append(kw) config.add_view = dummy_add_view - config.add_handler('name', '/{action}', DummyHandler) + config.add_handler('name', '/:action', DummyHandler) self._assertRoute(config, 'name', '/:action', 0) self.assertEqual(len(views), 2) @@ -1820,7 +1820,7 @@ class ConfiguratorTests(unittest.TestCase): config.add_view = dummy_add_view class MyView(DummyHandler): __autoexpose__ = None - config.add_handler('name', '/{action}', MyView) + config.add_handler('name', '/:action', MyView) self._assertRoute(config, 'name', '/:action', 0) self.assertEqual(len(views), 0) @@ -1856,7 +1856,7 @@ class ConfiguratorTests(unittest.TestCase): def action(self): # pragma: no cover return 'response' action.__exposed__ = [{'custom_predicates':(1,)}] - config.add_handler('name', '/{action}', MyView) + config.add_handler('name', '/:action', MyView) self._assertRoute(config, 'name', '/:action', 0) self.assertEqual(len(views), 1) view = views[0] @@ -1876,7 +1876,7 @@ class ConfiguratorTests(unittest.TestCase): def action(self): # pragma: no cover return 'response' action.__exposed__ = [{'name':'action3000'}] - config.add_handler('name', '/{action}', MyView) + config.add_handler('name', '/:action', MyView) self._assertRoute(config, 'name', '/:action', 0) self.assertEqual(len(views), 1) view = views[0] @@ -1902,7 +1902,7 @@ class ConfiguratorTests(unittest.TestCase): def action(self): # pragma: no cover return 'response' action.__exposed__ = [{'name':'^action3000$'}] - config.add_handler('name', '/{action}', MyView) + config.add_handler('name', '/:action', MyView) self._assertRoute(config, 'name', '/:action', 0) self.assertEqual(len(views), 1) view = views[0] @@ -2284,11 +2284,6 @@ class ConfiguratorTests(unittest.TestCase): route = config.add_route('name', 'pattern', pregenerator='123') self.assertEqual(route.pregenerator, '123') - def test_add_route_squiggly_syntax(self): - config = self._makeOne() - config.add_route('name', '/abc/{def}/:ghi/jkl/{mno}{/:p') - self._assertRoute(config, 'name', '/abc/:def/:ghi/jkl/:mno{/:p', 0) - def test__override_not_yet_registered(self): from pyramid.interfaces import IPackageOverrides package = DummyPackage('package') -- cgit v1.2.3