From c37d6ac18aaeb839fd38b2ef4a1a66b264ba3888 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 12 Nov 2009 01:43:09 +0000 Subject: - Use ``alsoProvides`` in the urldispatch module to attach an interface to the request rather than ``directlyProvides`` to avoid disturbing interfaces set in a NewRequest event handler. --- CHANGES.txt | 7 +++++++ repoze/bfg/urldispatch.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index fa09f8089..f7a979ea1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,13 @@ Next release ============ +Bug Fixes +--------- + +- Use ``alsoProvides`` in the urldispatch module to attach an + interface to the request rather than ``directlyProvides`` to avoid + disturbing interfaces set in a NewRequest event handler. + Documentation ------------- diff --git a/repoze/bfg/urldispatch.py b/repoze/bfg/urldispatch.py index 373c11f0b..7b0d4dbb7 100644 --- a/repoze/bfg/urldispatch.py +++ b/repoze/bfg/urldispatch.py @@ -1,7 +1,7 @@ import re from urllib import unquote -from zope.interface import directlyProvides +from zope.interface import alsoProvides from repoze.bfg.interfaces import IRouteRequest @@ -50,7 +50,7 @@ class RoutesRootFactory(object): # passed to it be a request, instead of an environ, as it # uses both the ``registry`` attribute of the request, and # if a route is found, it decorates the object with an - # interface using directlyProvides. However, existing app + # interface using alsoProvides. However, existing app # code "in the wild" calls the root factory explicitly # with a dictionary argument (e.g. a subscriber to # WSGIApplicationCreatedEvent does @@ -83,7 +83,7 @@ class RoutesRootFactory(object): request.matchdict = match iface = registry.queryUtility(IRouteRequest, name=route.name) if iface is not None: - directlyProvides(request, iface) + alsoProvides(request, iface) factory = route.factory or self.default_root_factory return factory(request) -- cgit v1.2.3