summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-06-21 05:21:07 -0400
committerChris McDonough <chrism@plope.com>2011-06-21 05:21:07 -0400
commite01f0747fbad12836471bbc24953f8f06985ba52 (patch)
treefccb6242c0e5994e62ebc28330a5887c7e4fc430
parent3e5d71ed0fc4c5ae9f2678ca9ebe5a13b37644d2 (diff)
downloadpyramid-e01f0747fbad12836471bbc24953f8f06985ba52.tar.gz
pyramid-e01f0747fbad12836471bbc24953f8f06985ba52.tar.bz2
pyramid-e01f0747fbad12836471bbc24953f8f06985ba52.zip
avoid some getattrs
-rw-r--r--pyramid/router.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/pyramid/router.py b/pyramid/router.py
index ef04497f9..458237a8c 100644
--- a/pyramid/router.py
+++ b/pyramid/router.py
@@ -56,8 +56,11 @@ class Router(object):
registry = self.registry
adapters = registry.adapters
has_listeners = registry.has_listeners
+ notify = registry.notify
logger = self.logger
manager = self.threadlocal_manager
+ routes_mapper = self.routes_mapper
+ debug_routematch = self.debug_routematch
request = None
threadlocals = {'registry':registry, 'request':request}
manager.push(threadlocals)
@@ -75,14 +78,14 @@ class Router(object):
request_iface = IRequest
try: # matches except Exception (exception view execution)
- has_listeners and registry.notify(NewRequest(request))
+ has_listeners and notify(NewRequest(request))
# find the root object
root_factory = self.root_factory
- if self.routes_mapper is not None:
- info = self.routes_mapper(request)
+ if routes_mapper is not None:
+ info = routes_mapper(request)
match, route = info['match'], info['route']
if route is None:
- if self.debug_routematch:
+ if debug_routematch:
msg = ('no route matched for url %s' %
request.url)
logger and logger.debug(msg)
@@ -96,7 +99,7 @@ class Router(object):
attrs['matchdict'] = match
attrs['matched_route'] = route
- if self.debug_routematch:
+ if debug_routematch:
msg = (
'route matched for url %s; '
'route_name: %r, '
@@ -131,7 +134,7 @@ class Router(object):
tdict['traversed'], tdict['virtual_root'],
tdict['virtual_root_path'])
attrs.update(tdict)
- has_listeners and registry.notify(ContextFound(request))
+ has_listeners and notify(ContextFound(request))
# find a view callable
context_iface = providedBy(context)
@@ -179,7 +182,7 @@ class Router(object):
'Could not convert view return value "%s" into a '
'response object' % (result,))
- has_listeners and registry.notify(NewResponse(request,response))
+ has_listeners and notify(NewResponse(request, response))
if request.response_callbacks:
request._process_response_callbacks(response)