From 277df8ebad5b9c6a3f45618354d7c3c96f55e247 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 10 May 2009 22:00:56 +0000 Subject: Minor speed and docs tweaks. --- CHANGES.txt | 2 +- repoze/bfg/urldispatch.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 759d84f47..0986820e0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,7 +5,7 @@ Features -------- - Added documentation to the URL Dispatch chapter about how to catch - the root URL. + the root URL using a ZCML ``route`` directive. Bug Fixes --------- diff --git a/repoze/bfg/urldispatch.py b/repoze/bfg/urldispatch.py index d3baf6d9f..ead8876de 100644 --- a/repoze/bfg/urldispatch.py +++ b/repoze/bfg/urldispatch.py @@ -115,6 +115,9 @@ class RoutesContextNotFound(object): def __init__(self, msg): self.msg = msg +_notfound = RoutesContextNotFound( + 'Routes context cannot be found and no fallback "get_root"') + class RoutesRootFactory(Mapper): """ The ``RoutesRootFactory`` is a wrapper for the ``get_root`` callable passed in to the repoze.bfg ``Router`` at initialization @@ -193,11 +196,8 @@ class RoutesRootFactory(Mapper): return context if self.get_root is None: - # no fallback get_root - return RoutesContextNotFound( - 'Routes context cannot be found and no fallback "get_root"') + return _notfound - # fall back to original get_root return self.get_root(environ) class RoutesModelTraverser(object): -- cgit v1.2.3