summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-07-03 00:07:04 +0000
committerianb <devnull@localhost>2005-07-03 00:07:04 +0000
commit11961ca7748d0d997b15113b1d2cf42f5e6b19e0 (patch)
treebc9cb809f6f568216095e20b1146724438421f80 /paste
parent94613049a6bc8de2c960bad0639ac6497ab30f6a (diff)
downloadpaste-11961ca7748d0d997b15113b1d2cf42f5e6b19e0.tar.gz
Make it slightly easier to capture output selectively, and otherwise not effect things
Diffstat (limited to 'paste')
-rw-r--r--paste/util/threadedprint.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/paste/util/threadedprint.py b/paste/util/threadedprint.py
index eb57a01..1bb9556 100644
--- a/paste/util/threadedprint.py
+++ b/paste/util/threadedprint.py
@@ -63,10 +63,16 @@ import filemixin
class PrintCatcher(filemixin.FileMixin):
- def __init__(self, default=None, factory=None, paramwriter=None):
+ def __init__(self, default=None, factory=None, paramwriter=None,
+ leave_stdout=False):
assert len(filter(lambda x: x is not None,
[default, factory, paramwriter])) <= 1, (
"You can only provide one of default, factory, or paramwriter")
+ if leave_stdout:
+ assert not default, (
+ "You cannot pass in both default (%r) and "
+ "leave_stdout=True" % default)
+ default = sys.stdout
if default:
self._defaultfunc = self._writedefault
elif factory:
@@ -109,7 +115,7 @@ class PrintCatcher(filemixin.FileMixin):
name = currentThread().getName()
self._catchers[name] = catcher
- def deregister(self, catcher, name=None,
+ def deregister(self, name=None,
currentThread=threading.currentThread):
if name is None:
name = currentThread().getName()