summaryrefslogtreecommitdiff
path: root/repoze/bfg/urldispatch.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-18 23:58:24 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-18 23:58:24 +0000
commit4ed2c89e70ac5bc828c8130cf0e0534cd6e29f35 (patch)
tree9ae8f597e2704e6f21bc5e3450870c7c59f3e2f9 /repoze/bfg/urldispatch.py
parent62267e01d6eeaf8de871487898ad1ce02878c29a (diff)
downloadpyramid-4ed2c89e70ac5bc828c8130cf0e0534cd6e29f35.tar.gz
pyramid-4ed2c89e70ac5bc828c8130cf0e0534cd6e29f35.tar.bz2
pyramid-4ed2c89e70ac5bc828c8130cf0e0534cd6e29f35.zip
context_factory -> factory
context_interfaces -> provides
Diffstat (limited to 'repoze/bfg/urldispatch.py')
-rw-r--r--repoze/bfg/urldispatch.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/repoze/bfg/urldispatch.py b/repoze/bfg/urldispatch.py
index 1881ebb07..f1470cd25 100644
--- a/repoze/bfg/urldispatch.py
+++ b/repoze/bfg/urldispatch.py
@@ -85,7 +85,7 @@ class RoutesMapper(object):
def connect(self, *arg, **kw):
""" Add a route to the Routes mapper associated with this
request. This method accepts the same arguments as a Routes
- *Mapper* object. One difference exists: if the
+ *Mapper* object. One differences exists: if the
``context_factory`` is passed in with a value as a keyword
argument, this callable will be called when a model object
representing the ``context`` for the request needs to be
@@ -117,7 +117,7 @@ class RoutesRootFactory(Mapper):
Any view that claims it is 'for' the interface
``repoze.bfg.interfaces.IRoutesContext`` will be called if its
*name* matches the Routes ``view_name`` name for the match and any
- of the interfaces named in ``context_interfaces``. It will be
+ of the interfaces named in ``_provides``. It will be
passed a context object that has attributes that match the Routes
match arguments dictionary keys. If no Routes route matches the
current request, the 'fallback' get_root is called."""
@@ -135,15 +135,15 @@ class RoutesRootFactory(Mapper):
def connect(self, *arg, **kw):
# we need to deal with our custom attributes specially :-(
- context_factory = None
- context_interfaces = ()
- if 'context_interfaces' in kw:
- context_interfaces = kw.pop('context_interfaces')
- if 'context_factory' in kw:
- context_factory = kw.pop('context_factory')
+ factory = None
+ provides = ()
+ if '_provides' in kw:
+ provides = kw.pop('_provides')
+ if '_factory' in kw:
+ factory = kw.pop('_factory')
result = Mapper.connect(self, *arg, **kw)
- self.matchlist[-1].context_factory = context_factory
- self.matchlist[-1].context_interfaces = context_interfaces
+ self.matchlist[-1]._factory = factory
+ self.matchlist[-1]._provides = provides
return result
def __call__(self, environ):
@@ -160,9 +160,9 @@ class RoutesRootFactory(Mapper):
if args:
args = args.copy()
routepath = route.routepath
- context_factory = route.context_factory
- if not context_factory:
- context_factory = DefaultRoutesContext
+ factory = route._factory
+ if not factory:
+ factory = DefaultRoutesContext
config = request_config()
config.mapper = self
config.mapper_dict = args
@@ -176,9 +176,9 @@ class RoutesRootFactory(Mapper):
if k.__class__ is unicode:
k = k.encode('utf-8')
kw[k] = v
- context = context_factory(**kw)
- context_interfaces = route.context_interfaces
- for iface in context_interfaces:
+ context = factory(**kw)
+ provides = route._provides
+ for iface in provides:
alsoProvides(context, iface)
alsoProvides(context, IRoutesContext)
return context