summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rossi <chris@christophermrossi.com>2009-07-22 16:04:55 +0000
committerChris Rossi <chris@christophermrossi.com>2009-07-22 16:04:55 +0000
commit8d222e48b669652a2c454047cf821439f10c2a8c (patch)
tree83149e2ee02f6d9b7bcfa094014a89c31cc6a25b
parentcb349cce3c3df4759a3b8f7979fa950459a8b511 (diff)
downloadpyramid-8d222e48b669652a2c454047cf821439f10c2a8c.tar.gz
pyramid-8d222e48b669652a2c454047cf821439f10c2a8c.tar.bz2
pyramid-8d222e48b669652a2c454047cf821439f10c2a8c.zip
Document close on '__del__' behavior of closer.
-rw-r--r--repoze/bfg/scripting.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/repoze/bfg/scripting.py b/repoze/bfg/scripting.py
index 5399b7d77..5694a8006 100644
--- a/repoze/bfg/scripting.py
+++ b/repoze/bfg/scripting.py
@@ -4,10 +4,12 @@ def get_root(app, environ=None):
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 ``environ`` is not None, it is used as the
- environment passed to the BFG application root factory. An empty
- environ is constructed and passed to the root factory if
- ``environ`` is None."""
+ the root. The closer also closes the db connection when its ``__del__``
+ method is called. This means the connection can also be closed by
+ explicitly deleting the closer using ``del`` or, more commonly, letting
+ it fall out of scope. If ``environ`` is not None, it is used as the
+ environment passed to the BFG application root factory. An empty environ
+ is constructed and passed to the root factory if ``environ`` is None."""
registry = app.registry
threadlocals = {'registry':registry, 'request':None}
app.threadlocal_manager.push(threadlocals)