Merge "Remove unused methods set_ctx and get_ctx"

This commit is contained in:
Zuul 2018-03-15 03:23:35 +00:00 committed by Gerrit Code Review
commit f5a2f1585c

View File

@ -13,7 +13,6 @@
import functools
import copy
from eventlet.green import threading
from oslo_context import context
from oslo_utils import timeutils
import six
@ -170,25 +169,6 @@ def get_admin_context(show_deleted=False, all_projects=False):
return context
_CTX_STORE = threading.local()
_CTX_KEY = 'current_ctx'
def has_ctx():
return hasattr(_CTX_STORE, _CTX_KEY)
def set_ctx(new_ctx):
if not new_ctx and has_ctx():
delattr(_CTX_STORE, _CTX_KEY)
if hasattr(context._request_store, 'context'):
delattr(context._request_store, 'context')
if new_ctx:
setattr(_CTX_STORE, _CTX_KEY, new_ctx)
setattr(context._request_store, 'context', new_ctx)
def set_context(func):
@functools.wraps(func)
def handler(self, ctx):