From d9e28ba02c30255511a56a59e93da283c172dffe Mon Sep 17 00:00:00 2001 From: Andrew Bogott Date: Mon, 2 Jul 2012 16:28:05 -0500 Subject: Move get_context_from_function_and_args() to context.py Word on the street is that exception.py may soon be deprecated, and context.py is a better place anyway. (Also removed an import of utils.py because /it/ imports exception.py.) Change-Id: I856fc6f4558cc01ddca350ee4cfd4684db47475b --- openstack/common/exception.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'openstack/common/exception.py') diff --git a/openstack/common/exception.py b/openstack/common/exception.py index e8ea110..e5da94b 100644 --- a/openstack/common/exception.py +++ b/openstack/common/exception.py @@ -146,20 +146,3 @@ class MalformedRequestBody(OpenstackException): class InvalidContentType(OpenstackException): message = "Invalid content type %(content_type)s" - - -def get_context_from_function_and_args(function, args, kwargs): - """Find an arg of type RequestContext and return it. - - This is useful in a couple of decorators where we don't - know much about the function we're wrapping. - """ - - # import here to avoid circularity: - from openstack.common import context - - for arg in itertools.chain(kwargs.values(), args): - if isinstance(arg, context.RequestContext): - return arg - - return None -- cgit