summaryrefslogtreecommitdiff
path: root/paste/printdebug.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-09-09 18:04:31 +0000
committerianb <devnull@localhost>2005-09-09 18:04:31 +0000
commitdfb5844662ca8335586e4d7d88543fa7d16169e3 (patch)
tree7b6e079024c32e9c5e9dda72437ee25a3e953a04 /paste/printdebug.py
parent21b09f39ab4f46d803c26ec463c1fa3fcc5be37c (diff)
downloadpaste-dfb5844662ca8335586e4d7d88543fa7d16169e3.tar.gz
Handle unicode printing; don't capture when run in a unit testing environment
Diffstat (limited to 'paste/printdebug.py')
-rw-r--r--paste/printdebug.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/paste/printdebug.py b/paste/printdebug.py
index 381c831..00915ad 100644
--- a/paste/printdebug.py
+++ b/paste/printdebug.py
@@ -19,6 +19,9 @@ class TeeFile(object):
self.files = files
def write(self, v):
+ if isinstance(v, unicode):
+ # WSGI is picky in this case
+ v = str(v)
for file in self.files:
file.write(v)
@@ -44,6 +47,10 @@ class PrintDebugMiddleware(object):
def __call__(self, environ, start_response):
global _threadedprint_installed
+ if environ.get('paste.testing'):
+ # In a testing environment this interception isn't
+ # useful:
+ return self.app(environ, start_response)
if not _threadedprint_installed:
# @@: Not strictly threadsafe
_threadedprint_installed = True