From 6fec211488f87f9207fda9c39b21e83c6359c727 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 23 Nov 2009 04:51:35 +0000 Subject: - The ``repoze.bfg.scripting.get_root`` API now uses a 'real' WebOb request rather than a FakeRequest when it sets up the request as a threadlocal. - The ``repoze.bfg.traversal.traverse`` API now uses a 'real' WebOb request rather than a FakeRequest when it calls the traverser. - The ``repoze.bfg.request.FakeRequest`` class has been removed. ``repoze.bfg.url.route_url`` ``repoze.bfg.url.model_url`` ``repoze.bfg.url.static_url`` ``repoze.bfg.traversal.virtual_root`` Each of these functions now expects to be called with a request object that has a ``registry`` attribute which represents the current ZCA registry. Get rid of extraneous uses of ZCA threadlocal API. --- repoze/bfg/scripting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'repoze/bfg/scripting.py') diff --git a/repoze/bfg/scripting.py b/repoze/bfg/scripting.py index f31db56fa..bf2423a8c 100644 --- a/repoze/bfg/scripting.py +++ b/repoze/bfg/scripting.py @@ -1,4 +1,4 @@ -from repoze.bfg.request import FakeRequest +from repoze.bfg.request import Request def get_root(app, request=None): """ Return a tuple composed of ``(root, closer)`` when provided a @@ -9,9 +9,10 @@ def get_root(app, request=None): the root. If ``request`` is not None, it is used as the request passed to the BFG application root factory. A faux request is constructed and passed to the root factory if ``request`` is None.""" - if request is None: - request = FakeRequest({}) registry = app.registry + if request is None: + request = Request.blank('/') + request.registry = registry threadlocals = {'registry':registry, 'request':request} app.threadlocal_manager.push(threadlocals) def closer(request=request): # keep request alive via this function default -- cgit v1.2.3