- Primary Maintainer:
- Other Contributors:
oslo.context holds the context base class, which defines APIs used by oslo.messaging and oslo.log.
What is the name of the new library?: oslo.context
All of the existing public functions and classes will remain public.
def generate_request_id(): "Return a unique request identifier." class RequestContext(object): """Helper class to represent useful information about a request context. Stores information about the security context under which the user accesses the system, as well as additional request information. """ def get_admin_context(show_deleted=False): "Return a RequestContext configured as an admin user" 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. """ def is_user_context(context): """Indicates if the request context is a normal user."""
A private registry of context objects will be kept using a threading.local() instance and logic based on nova.context.RequestContext. A new public API for accessing the context will be added:
def get_current(): "Return this thread's current context"
Target Milestone for completion: kilo-1
Projects using oslo.context should subclass oslo_context.RequestContext and create their own application-specific context class.
This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode