Chris McDonough
2010-11-20 df3f64ac77304db5d95a1cd33f07320a458b278a
convert stray references to colon routing syntax to squiggly syntax
15 files modified
102 ■■■■ changed files
docs/narr/contextfinding.rst 2 ●●● patch | view | raw | blame | history
docs/narr/declarative.rst 2 ●●● patch | view | raw | blame | history
docs/narr/handlers.rst 10 ●●●● patch | view | raw | blame | history
docs/narr/hybrid.rst 30 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/definingviews.rst 8 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/authorization/tutorial/__init__.py 6 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/authorization/tutorial/tests.py 8 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/views/tutorial/__init__.py 6 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/views/tutorial/tests.py 8 ●●●● patch | view | raw | blame | history
docs/zcml/route.rst 6 ●●●● patch | view | raw | blame | history
pyramid/configuration.py 6 ●●●● patch | view | raw | blame | history
pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl 2 ●●● patch | view | raw | blame | history
pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl 2 ●●● patch | view | raw | blame | history
pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl 2 ●●● patch | view | raw | blame | history
pyramid/url.py 4 ●●●● patch | view | raw | blame | history
docs/narr/contextfinding.rst
@@ -75,7 +75,7 @@
``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
docs/narr/declarative.rst
@@ -655,7 +655,7 @@
   <route
       name="myroute"
       pattern="/prefix/:one/:two"
       pattern="/prefix/{one}/{two}"
       view=".views.myview"
    />
docs/narr/handlers.rst
@@ -59,11 +59,11 @@
.. 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 @@
.. 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 @@
            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
docs/narr/hybrid.rst
@@ -42,8 +42,8 @@
   # 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 @@
.. 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 @@
.. 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 @@
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 @@
.. 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 @@
.. 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 @@
.. 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 @@
.. 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 @@
.. 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 @@
.. 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
docs/tutorials/wiki2/definingviews.rst
@@ -24,7 +24,7 @@
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 @@
   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.
docs/tutorials/wiki2/src/authorization/tutorial/__init__.py
@@ -29,14 +29,14 @@
                     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')
docs/tutorials/wiki2/src/authorization/tutorial/tests.py
@@ -14,9 +14,9 @@
    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 @@
        
    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')
docs/tutorials/wiki2/src/views/tutorial/__init__.py
@@ -14,13 +14,13 @@
    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()
docs/tutorials/wiki2/src/views/tutorial/tests.py
@@ -14,9 +14,9 @@
    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 @@
        
    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')
docs/zcml/route.rst
@@ -10,7 +10,7 @@
~~~~~~~~~~
``pattern``
  The pattern of the route e.g. ``ideas/:idea``.  This attribute is
  The pattern of the route e.g. ``ideas/{idea}``.  This attribute is
  required.  See :ref:`route_pattern_syntax` for information
  about the syntax of route patterns.
@@ -51,9 +51,9 @@
  The syntax of the ``traverse`` argument is the same as it is for
  ``pattern``. For example, if the ``pattern`` provided to the
  ``route`` directive is ``articles/:article/edit``, and the
  ``route`` directive is ``articles/{article}/edit``, and the
  ``traverse`` argument provided to the ``route`` directive is
  ``/:article``, when a request comes in that causes the route to
  ``/{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``.  This means that the root object's
pyramid/configuration.py
@@ -1260,9 +1260,9 @@
          The syntax of the ``traverse`` argument is the same as it is
          for ``pattern``. For example, if the ``pattern`` provided to
          ``add_route`` is ``articles/:article/edit``, and the
          ``add_route`` is ``articles/{article}/edit``, and the
          ``traverse`` argument provided to ``add_route`` is
          ``/:article``, when a request comes in that causes the route
          ``/{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``.  This means that
@@ -1306,7 +1306,7 @@
        pattern
          The pattern of the route e.g. ``ideas/:idea``.  This
          The pattern of the route e.g. ``ideas/{idea}``.  This
          argument is required.  See :ref:`route_path_pattern_syntax`
          for information about the syntax of route patterns.  If the
          pattern doesn't match the current URL, route matching
pyramid/paster_templates/pylons_basic/+package+/__init__.py_tmpl
@@ -8,7 +8,7 @@
    session_factory = session_factory_from_settings(settings)
    config.set_session_factory(session_factory)
    config.add_static_view('static', '{{package}}:static/')
    config.add_handler('action', '/:action',
    config.add_handler('action', '/{action}',
                       '{{package}}.handlers.hello:HelloHandler')
    config.add_handler('home', '/', '{{package}}.handlers.hello:HelloHandler',
                       action='index')
pyramid/paster_templates/pylons_minimal/+package+/__init__.py_tmpl
@@ -8,7 +8,7 @@
    session_factory = session_factory_from_settings(settings)
    config.set_session_factory(session_factory)
    config.add_static_view('static', '{{package}}:static/')
    config.add_handler('action', '/:action', '{{package}}.handlers:MyHandler')
    config.add_handler('action', '/{action}', '{{package}}.handlers:MyHandler')
    config.add_handler('home', '/', '{{package}}.handlers:MyHandler',
                       action='index')
    config.add_subscriber('{{package}}.subscribers.add_renderer_globals',
pyramid/paster_templates/pylons_sqla/+package+/__init__.py_tmpl
@@ -16,7 +16,7 @@
    session_factory = session_factory_from_settings(settings)
    config.set_session_factory(session_factory)
    config.add_static_view('static', '{{package}}:static/')
    config.add_handler('main', '/:action', '{{package}}.handlers:MyHandler')
    config.add_handler('main', '/{action}', '{{package}}.handlers:MyHandler')
    config.add_handler('home', '/', '{{package}}.handlers:MyHandler',
                       action='index')
    config.add_subscriber('{{package}}.subscribers.add_renderer_globals',
pyramid/url.py
@@ -32,7 +32,7 @@
    enough arguments, for example).
    For example, if you've defined a route named "foobar" with the path
    ``:foo/:bar/*traverse``::
    ``:foo/{bar}/*traverse``::
        route_url('foobar', request, foo='1')          => <KeyError exception>
        route_url('foobar', request, foo='1', bar='2') => <KeyError exception>
@@ -166,7 +166,7 @@
    and anchor data are present in the returned string.
    For example, if you've defined a route named 'foobar' with the path
    ``/:foo/:bar``, this call to ``route_path``::
    ``/{foo}/{bar}``, this call to ``route_path``::
        route_path('foobar', request, foo='1', bar='2')