From 0c29cf2df41600d3906d521c72991c7686018b71 Mon Sep 17 00:00:00 2001 From: Michael Merickel <michael@merickel.org> Date: Mon, 15 Oct 2018 16:24:07 +0200 Subject: [PATCH] format source using black --- src/pyramid/threadlocal.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pyramid/threadlocal.py b/src/pyramid/threadlocal.py index e8f8257..7eca5b0 100644 --- a/src/pyramid/threadlocal.py +++ b/src/pyramid/threadlocal.py @@ -2,6 +2,7 @@ from pyramid.registry import global_registry + class ThreadLocalManager(threading.local): def __init__(self, default=None): # http://code.google.com/p/google-app-engine-django/issues/detail?id=119 @@ -15,7 +16,7 @@ def push(self, info): self.stack.append(info) - set = push # b/c + set = push # b/c def pop(self): if self.stack: @@ -30,10 +31,13 @@ def clear(self): self.stack[:] = [] + def defaults(): return {'request': None, 'registry': global_registry} + manager = ThreadLocalManager(default=defaults) + def get_current_request(): """ @@ -49,7 +53,10 @@ """ return manager.get()['request'] -def get_current_registry(context=None): # context required by getSiteManager API + +def get_current_registry( + context=None +): # context required by getSiteManager API """ Return the currently active :term:`application registry` or the global application registry if no request is currently active. @@ -63,6 +70,7 @@ """ return manager.get()['registry'] + class RequestContext(object): def __init__(self, request): self.request = request -- Gitblit v1.9.3