From 6899dbab4003886a5ed0eff27667ed2ffd7663e7 Mon Sep 17 00:00:00 2001 From: ianb Date: Sun, 27 Apr 2008 06:26:24 +0000 Subject: Add some more methods to the threaded replacement for stdout (for appengine) --- docs/news.txt | 2 ++ paste/util/threadedprint.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/news.txt b/docs/news.txt index 931ac30..0543556 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -52,6 +52,8 @@ svn trunk * Use ``environ['wsgi.file_wrapper']`` when available (in ``paste.fileapp``). +* Make ``paste.debug.prints` compatible with App Engine. + 1.6.1 ----- diff --git a/paste/util/threadedprint.py b/paste/util/threadedprint.py index 0cdcdd6..c95d3a1 100644 --- a/paste/util/threadedprint.py +++ b/paste/util/threadedprint.py @@ -98,6 +98,24 @@ class PrintCatcher(filemixin.FileMixin): catcher = catchers[name] catcher.write(v) + def seek(self, *args): + # Weird, but Google App Engine is seeking on stdout + name = threading.currentThread().getName() + catchers = self._catchers + if not name in catchers: + self._default.seek(*args) + else: + catchers[name].seek(*args) + + def read(self, *args): + name = threading.currentThread().getName() + catchers = self._catchers + if not name in catchers: + self._default.read(*args) + else: + catchers[name].read(*args) + + def _writedefault(self, name, v): self._default.write(v) -- cgit v1.2.1