From df3f64ac77304db5d95a1cd33f07320a458b278a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 20 Nov 2010 15:56:58 -0500 Subject: convert stray references to colon routing syntax to squiggly syntax --- docs/narr/contextfinding.rst | 2 +- docs/narr/declarative.rst | 2 +- docs/narr/handlers.rst | 10 +++++----- docs/narr/hybrid.rst | 30 +++++++++++++++--------------- 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'docs/narr') diff --git a/docs/narr/contextfinding.rst b/docs/narr/contextfinding.rst index c3fbe7f5a..770f97d15 100644 --- a/docs/narr/contextfinding.rst +++ b/docs/narr/contextfinding.rst @@ -75,7 +75,7 @@ URL dispatch can easily handle URLs such as ``http://example.com/members/Chris``, where it's assumed that each item "below" ``members`` in the URL represents a single member in some system. You just match everything "below" ``members`` to a particular -:term:`view callable`, e.g. ``/members/:memberid``. +:term:`view callable`, e.g. ``/members/{memberid}``. However, URL dispatch is not very convenient if you'd like your URLs to represent an arbitrary hierarchy. For example, if you need to diff --git a/docs/narr/declarative.rst b/docs/narr/declarative.rst index 48a3ea134..b9dbcab7d 100644 --- a/docs/narr/declarative.rst +++ b/docs/narr/declarative.rst @@ -655,7 +655,7 @@ declaration` causes a route to be added to the application. diff --git a/docs/narr/handlers.rst b/docs/narr/handlers.rst index b8e7b5d9b..022f27115 100644 --- a/docs/narr/handlers.rst +++ b/docs/narr/handlers.rst @@ -59,11 +59,11 @@ be performed in order to register it with the system: .. code-block:: python - config.add_handler('hello', '/hello/:action', handler=Hello) + config.add_handler('hello', '/hello/{action}', handler=Hello) This example will result in a route being added for the pattern -``/hello/:action``, each method of the ``Hello`` class will then be examined -to register the views. The value of ``:action`` in the route pattern will be +``/hello/{action}``, each method of the ``Hello`` class will then be examined +to register the views. The value of ``{action}`` in the route pattern will be used to determine which view should be called, and each view in the class will be setup with a view predicate that requires a specific ``action`` name. @@ -98,7 +98,7 @@ For example: .. code-block:: python - config.add_handler('hello', '/hello/:action', + config.add_handler('hello', '/hello/{action}', handler='mypackage.handlers:MyHandler') In larger applications, it is advised to use a :term:`resource specification` @@ -219,7 +219,7 @@ Example: return {} # in the config - config.add_handler('hello', '/hello/:action', handler=Hello) + config.add_handler('hello', '/hello/{action}', handler=Hello) With this configuration, the url ``/hello/home`` will find a view configuration that results in calling the ``show_template`` method, then rendering the diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst index b89d10c9f..e704463c7 100644 --- a/docs/narr/hybrid.rst +++ b/docs/narr/hybrid.rst @@ -42,8 +42,8 @@ configuration: # config is an instance of pyramid.configuration.Configurator - config.add_route('foobar', ':foo/:bar', view='myproject.views.foobar') - config.add_route('bazbuz', ':baz/:buz', view='myproject.views.bazbuz') + config.add_route('foobar', '{foo}/{bar}', view='myproject.views.foobar') + config.add_route('bazbuz', '{baz}/{buz}', view='myproject.views.bazbuz') Each :term:`route` typically corresponds to a single view callable, and when that route is matched during a request, the view callable @@ -185,7 +185,7 @@ of a route's pattern: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse') + config.add_route('home', '{foo}/{bar}/*traverse') A ``*traverse`` token at the end of the pattern in a route's configuration implies a "remainder" *capture* value. When it is used, @@ -243,7 +243,7 @@ route configuration statement: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse', + config.add_route('home', '{foo}/{bar}/*traverse', factory='mypackage.routes.root_factory') The ``factory`` above points at the function we've defined. It @@ -267,14 +267,14 @@ to do. When the route configuration named ``home`` above is matched during a request, the matchdict generated will be based on its pattern: -``:foo/:bar/*traverse``. The "capture value" implied by the +``{foo}/{bar}/*traverse``. The "capture value" implied by the ``*traverse`` element in the pattern will be used to traverse the graph in order to find a context, starting from the root object returned from the root factory. In the above example, the :term:`root` object found will be the instance named ``root`` in ``routes.py``. -If the URL that matched a route with the pattern ``:foo/:bar/*traverse``, +If the URL that matched a route with the pattern ``{foo}/{bar}/*traverse``, is ``http://example.com/one/two/a/b/c``, the traversal path used against the root object will be ``a/b/c``. As a result, :app:`Pyramid` will attempt to traverse through the edges ``a``, @@ -296,7 +296,7 @@ invoked after a route matches: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse', + config.add_route('home', '{foo}/{bar}/*traverse', factory='mypackage.routes.root_factory') config.add_view('mypackage.views.myview', route_name='home') @@ -326,7 +326,7 @@ when a hybrid route is matched: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse', + config.add_route('home', '{foo}/{bar}/*traverse', factory='mypackage.routes.root_factory') config.add_view('mypackage.views.myview', name='home') config.add_view('mypackage.views.another_view', name='another', @@ -371,14 +371,14 @@ Here's a use of the ``traverse`` pattern in a call to .. code-block:: python :linenos: - config.add_route('abc', '/articles/:article/edit', - traverse='/articles/:article') + config.add_route('abc', '/articles/{article}/edit', + traverse='/articles/{article}') The syntax of the ``traverse`` argument is the same as it is for ``pattern``. -If, as above, the ``pattern`` provided is ``articles/:article/edit``, -and the ``traverse`` argument provided is ``/:article``, when a +If, as above, the ``pattern`` provided is ``articles/{article}/edit``, +and the ``traverse`` argument provided is ``/{article}``, when a request comes in that causes the route to match in such a way that the ``article`` match value is ``1`` (when the request URI is ``/articles/1/edit``), the traversal path will be generated as ``/1``. @@ -467,7 +467,7 @@ startup time. .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse', + config.add_route('home', '{foo}/{bar}/*traverse', view='myproject.views.home') config.add_view('myproject.views.another', route_name='home') @@ -479,7 +479,7 @@ supply a view attribute. For example, this ``add_route`` call: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse', + config.add_route('home', '{foo}/{bar}/*traverse', view='myproject.views.home') Can also be spelled like so: @@ -487,7 +487,7 @@ Can also be spelled like so: .. code-block:: python :linenos: - config.add_route('home', ':foo/:bar/*traverse') + config.add_route('home', '{foo}/{bar}/*traverse') config.add_view('myproject.views.home', route_name='home') The two spellings are logically equivalent. In fact, the former is -- cgit v1.2.3