diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-06-22 13:14:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 11:14:13 +0100 |
commit | 6871824f9f87b63bdf5c863971df4c6a454f105c (patch) | |
tree | 830680a4c5665a9cf33cf9f58db0cd395137bc04 /paste/util/threadedprint.py | |
parent | 225c7ebf34a9c90435932b690967538493a943ce (diff) | |
download | paste-git-6871824f9f87b63bdf5c863971df4c6a454f105c.tar.gz |
Replace deprecated threading aliases (#69)
Diffstat (limited to 'paste/util/threadedprint.py')
-rw-r--r-- | paste/util/threadedprint.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/paste/util/threadedprint.py b/paste/util/threadedprint.py index 820311e..7635f75 100644 --- a/paste/util/threadedprint.py +++ b/paste/util/threadedprint.py @@ -27,7 +27,7 @@ paramwriter called like ``paramwriter(thread_name, text)`` for every write. The thread name is the value returned by -``threading.currentThread().getName()``, a string (typically something +``threading.current_thread().name``, a string (typically something like Thread-N). You can also submit file-like objects for specific threads, which will @@ -89,8 +89,8 @@ class PrintCatcher(filemixin.FileMixin): self._paramwriter = paramwriter self._catchers = {} - def write(self, v, currentThread=threading.currentThread): - name = currentThread().getName() + def write(self, v, currentThread=threading.current_thread): + name = current_thread().name catchers = self._catchers if not catchers.has_key(name): self._defaultfunc(name, v) @@ -100,7 +100,7 @@ class PrintCatcher(filemixin.FileMixin): def seek(self, *args): # Weird, but Google App Engine is seeking on stdout - name = threading.currentThread().getName() + name = threading.current_thread().name catchers = self._catchers if not name in catchers: self._default.seek(*args) @@ -108,7 +108,7 @@ class PrintCatcher(filemixin.FileMixin): catchers[name].seek(*args) def read(self, *args): - name = threading.currentThread().getName() + name = threading.current_thread().name catchers = self._catchers if not name in catchers: self._default.read(*args) @@ -131,15 +131,15 @@ class PrintCatcher(filemixin.FileMixin): % name) def register(self, catcher, name=None, - currentThread=threading.currentThread): + currentThread=threading.current_thread): if name is None: - name = currentThread().getName() + name = currentThread().name self._catchers[name] = catcher def deregister(self, name=None, - currentThread=threading.currentThread): + currentThread=threading.current_thread): if name is None: - name = currentThread().getName() + name = currentThread().name assert self._catchers.has_key(name), ( "There is no PrintCatcher catcher for the thread %r" % name) del self._catchers[name] @@ -189,8 +189,8 @@ class StdinCatcher(filemixin.FileMixin): self._paramwriter = paramwriter self._catchers = {} - def read(self, size=None, currentThread=threading.currentThread): - name = currentThread().getName() + def read(self, size=None, currentThread=threading.current_thread): + name = currentThread().name catchers = self._catchers if not catchers.has_key(name): return self._defaultfunc(name, size) @@ -213,15 +213,15 @@ class StdinCatcher(filemixin.FileMixin): % name) def register(self, catcher, name=None, - currentThread=threading.currentThread): + currentThread=threading.current_thread): if name is None: - name = currentThread().getName() + name = currentThread().name self._catchers[name] = catcher def deregister(self, catcher, name=None, - currentThread=threading.currentThread): + currentThread=threading.current_thread): if name is None: - name = currentThread().getName() + name = currentThread().name assert self._catchers.has_key(name), ( "There is no StdinCatcher catcher for the thread %r" % name) del self._catchers[name] |