From 74409d12f7eb085bc992a200cc74799e4d1ff355 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 8 Sep 2010 04:25:35 +0000 Subject: - The ``repoze.bfg.urldispatch.Route`` constructor (not an API) now accepts a different ordering of arguments. Previously it was ``(pattern, name, factory=None, predicates=())``. It is now ``(name, pattern, factory=None, predicates=())``. This is in support of consistency with ``configurator.add_route``. - The ``repoze.bfg.urldispatch.RoutesMapper.connect`` method (not an API) now accepts a different ordering of arguments. Previously it was ``(pattern, name, factory=None, predicates=())``. It is now ``(name, pattern, factory=None, predicates=())``. This is in support of consistency with ``configurator.add_route``. - The ``repoze.bfg.urldispatch.RoutesMapper`` object now has a ``get_route`` method which returns a single Route object or ``None``. - A new interface ``repoze.bfg.interfaces.IRoute`` was added. The ``repoze.bfg.urldispatch.Route`` object implements this interface. - The canonical attribute for accessing the routing pattern from a route object is now ``pattern`` rather than ``path``. - The argument to ``repoze.bfg.configuration.Configurator.add_route`` which was previously called ``path`` is now called ``pattern`` for better explicability. For backwards compatibility purposes, passing a keyword argument named ``path`` to ``add_route`` will still work indefinitely. - The ``path`` attribute to the ZCML ``route`` directive is now named ``pattern`` for better explicability. The older ``path`` attribute will continue to work indefinitely. - All narrative, API, and tutorial docs which referred to a route pattern as a ``path`` have now been updated to refer to them as a ``pattern``. - The routesalchemy template has been updated to use ``pattern`` in its route declarations rather than ``path``. --- repoze/bfg/testing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'repoze/bfg/testing.py') diff --git a/repoze/bfg/testing.py b/repoze/bfg/testing.py index 5502cb3d2..c99ba8706 100644 --- a/repoze/bfg/testing.py +++ b/repoze/bfg/testing.py @@ -290,12 +290,12 @@ def registerSubscriber(subscriber, iface=Interface): config = Configurator(registry) return config.add_subscriber(subscriber, iface=iface) -def registerRoute(path, name, factory=None): - """ Register a new :term:`route` using a path +def registerRoute(pattern, name, factory=None): + """ Register a new :term:`route` using a pattern (e.g. ``:pagename``), a name (e.g. ``home``), and an optional root factory. - The ``path`` argument implies the route path. The ``name`` + The ``pattern`` argument implies the route pattern. The ``name`` argument implies the route name. The ``factory`` argument implies a :term:`root factory` associated with the route. @@ -311,7 +311,7 @@ def registerRoute(path, name, factory=None): """ reg = get_current_registry() config = Configurator(registry=reg) - return config.add_route(name, path, factory=factory) + return config.add_route(name, pattern, factory=factory) def registerRoutesMapper(root_factory=None): """ Register a routes 'mapper' object. -- cgit v1.2.3