summaryrefslogtreecommitdiff
path: root/repoze/bfg/scripting.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-10-25 10:29:31 -0400
committerChris McDonough <chrism@plope.com>2010-10-25 10:29:31 -0400
commit64372401084889a440c9d990a0febc221e3e4b5c (patch)
treec8939a341505d19f19fa6918d264b4e1d95326f8 /repoze/bfg/scripting.py
parentc8e78c2037806f3e5dab57de635bf80865b7061d (diff)
downloadpyramid-64372401084889a440c9d990a0febc221e3e4b5c.tar.gz
pyramid-64372401084889a440c9d990a0febc221e3e4b5c.tar.bz2
pyramid-64372401084889a440c9d990a0febc221e3e4b5c.zip
first pass at converting bfg to pyramid namespace
Diffstat (limited to 'repoze/bfg/scripting.py')
-rw-r--r--repoze/bfg/scripting.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/repoze/bfg/scripting.py b/repoze/bfg/scripting.py
deleted file mode 100644
index ca0bea597..000000000
--- a/repoze/bfg/scripting.py
+++ /dev/null
@@ -1,25 +0,0 @@
-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
- :term:`router` instance as the ``app`` argument. The ``root``
- returned is the application root object. The ``closer`` returned
- is a callable (accepting no arguments) that should be called when
- your scripting application is finished using the root. If
- ``request`` is not None, it is used as the request passed to the
- :mod:`repoze.bfg` application root factory. A request is
- constructed and passed to the root factory if ``request`` is None."""
- registry = app.registry
- if request is None:
- request_factory = registry.queryUtility(
- IRequestFactory, default=Request)
- request = request_factory.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
- app.threadlocal_manager.pop()
- root = app.root_factory(request)
- return root, closer
-