From 81a833da2adff04d11b9228406bbc1528be65c64 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 24 Jul 2010 07:04:49 +0000 Subject: - A new method of the ``Configurator`` exists: ``set_request_factory``. If used, this method will set the factory used by the :mod:`repoze.bfg` router to create all request objects. - The ``Configurator`` constructor takes an additional argument: ``request_factory``. If used, this argument will set the factory used by the :mod:`repoze.bfg` router to create all request objects. - The ``Hooks`` narrative chapter now contains a section about changing the request factory. --- repoze/bfg/scripting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'repoze/bfg/scripting.py') diff --git a/repoze/bfg/scripting.py b/repoze/bfg/scripting.py index 8547eae62..ca0bea597 100644 --- a/repoze/bfg/scripting.py +++ b/repoze/bfg/scripting.py @@ -1,4 +1,5 @@ from repoze.bfg.request import Request +from repoze.bfg.interfaces import IRequestFactory def get_root(app, request=None): """ Return a tuple composed of ``(root, closer)`` when provided a @@ -11,7 +12,9 @@ def get_root(app, request=None): constructed and passed to the root factory if ``request`` is None.""" registry = app.registry if request is None: - request = Request.blank('/') + request_factory = registry.queryUtility( + IRequestFactory, default=Request) + request = request_factory.blank('/') request.registry = registry threadlocals = {'registry':registry, 'request':request} app.threadlocal_manager.push(threadlocals) -- cgit v1.2.3