diff options
Diffstat (limited to 'docs/tutorials')
5 files changed, 18 insertions, 18 deletions
diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index b87cd6a64..0f446bb4e 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -24,7 +24,7 @@ The request passed to every view that is called as the result of a route match has an attribute named ``matchdict`` that contains the elements placed into the URL by the ``pattern`` of a ``route`` statement. For instance, if a call to :meth:`pyramid.configuration.Configurator.add_route` in -``__init__.py`` had the pattern ``:one/:two``, and the URL at +``__init__.py`` had the pattern ``{one}/{two}``, and the URL at ``http://example.com/foo/bar`` was invoked, matching this pattern, the matchdict dictionary attached to the request passed to the view would have a ``one`` key with the value ``foo`` and a ``two`` key with the value ``bar``. @@ -277,16 +277,16 @@ the order they're found in the ``__init__.py`` file. to the view named ``view_wiki`` in our ``views.py`` file with the name ``view_wiki``. This is the :term:`default view` for the wiki. -#. Add a declaration which maps the pattern ``/:pagename`` to the view named +#. Add a declaration which maps the pattern ``/{pagename}`` to the view named ``view_page`` in our ``views.py`` file with the view name ``view_page``. This is the regular view for a page. #. Add a declaration which maps the pattern - ``/add_page/:pagename`` to the view named ``add_page`` in our + ``/add_page/{pagename}`` to the view named ``add_page`` in our ``views.py`` file with the name ``add_page``. This is the add view for a new page. -#. Add a declaration which maps the pattern ``/:pagename/edit_page`` to the +#. Add a declaration which maps the pattern ``/{pagename}/edit_page`` to the view named ``edit_page`` in our ``views.py`` file with the name ``edit_page``. This is the edit view for a page. diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py index 8269617f2..771b2e3d7 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py @@ -29,14 +29,14 @@ def main(global_config, **settings): view_renderer='tutorial:templates/login.pt') config.add_route('logout', '/logout', view='tutorial.login.logout') - config.add_route('view_page', '/:pagename', + config.add_route('view_page', '/{pagename}', view='tutorial.views.view_page', view_renderer='tutorial:templates/view.pt') - config.add_route('add_page', '/add_page/:pagename', + config.add_route('add_page', '/add_page/{pagename}', view='tutorial.views.add_page', view_renderer='tutorial:templates/edit.pt', view_permission='edit') - config.add_route('edit_page', '/:pagename/edit_page', + config.add_route('edit_page', '/{pagename}/edit_page', view='tutorial.views.edit_page', view_renderer='tutorial:templates/edit.pt', view_permission='edit') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py index 65330ce17..c78899797 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py @@ -14,9 +14,9 @@ def _initTestingDB(): return DBSession def _registerRoutes(config): - config.add_route('view_page', ':pagename') - config.add_route('edit_page', ':pagename/edit_page') - config.add_route('add_page', 'add_page/:pagename') + config.add_route('view_page', '{pagename}') + config.add_route('edit_page', '{pagename}/edit_page') + config.add_route('add_page', 'add_page/{pagename}') class ViewWikiTests(unittest.TestCase): def setUp(self): @@ -28,7 +28,7 @@ class ViewWikiTests(unittest.TestCase): def test_it(self): from tutorial.views import view_wiki - self.config.add_route('view_page', ':pagename') + self.config.add_route('view_page', '{pagename}') request = testing.DummyRequest() response = view_wiki(request) self.assertEqual(response.location, 'http://example.com/FrontPage') diff --git a/docs/tutorials/wiki2/src/views/tutorial/__init__.py b/docs/tutorials/wiki2/src/views/tutorial/__init__.py index 947ce9b93..aa75c359a 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/__init__.py +++ b/docs/tutorials/wiki2/src/views/tutorial/__init__.py @@ -14,13 +14,13 @@ def main(global_config, **settings): config = Configurator(settings=settings) config.add_static_view('static', 'tutorial:static') config.add_route('home', '/', view='tutorial.views.view_wiki') - config.add_route('view_page', '/:pagename', + config.add_route('view_page', '/{pagename}', view='tutorial.views.view_page', view_renderer='tutorial:templates/view.pt') - config.add_route('add_page', '/add_page/:pagename', + config.add_route('add_page', '/add_page/{pagename}', view='tutorial.views.add_page', view_renderer='tutorial:templates/edit.pt') - config.add_route('edit_page', '/:pagename/edit_page', + config.add_route('edit_page', '/{pagename}/edit_page', view='tutorial.views.edit_page', view_renderer='tutorial:templates/edit.pt') return config.make_wsgi_app() diff --git a/docs/tutorials/wiki2/src/views/tutorial/tests.py b/docs/tutorials/wiki2/src/views/tutorial/tests.py index 40336fca4..435e4b588 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/tests.py +++ b/docs/tutorials/wiki2/src/views/tutorial/tests.py @@ -14,9 +14,9 @@ def _initTestingDB(): return DBSession def _registerRoutes(config): - config.add_route('view_page', ':pagename') - config.add_route('edit_page', ':pagename/edit_page') - config.add_route('add_page', 'add_page/:pagename') + config.add_route('view_page', '{pagename}') + config.add_route('edit_page', '{pagename}/edit_page') + config.add_route('add_page', 'add_page/{pagename}') class ViewWikiTests(unittest.TestCase): def setUp(self): @@ -28,7 +28,7 @@ class ViewWikiTests(unittest.TestCase): def test_it(self): from tutorial.views import view_wiki - self.config.add_route('view_page', ':pagename') + self.config.add_route('view_page', '{pagename}') request = testing.DummyRequest() response = view_wiki(request) self.assertEqual(response.location, 'http://example.com/FrontPage') |
