oslo_context.context
Module¶Base class for holding contextual information of a request
This class has several uses:
Used for storing security information in a web request.
Used for passing contextual details to oslo.log.
Projects should subclass this class if they wish to enhance the request context or provide additional information in their specific WSGI pipeline or logging context.
Bases: 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.
Construct a context object from a provided dictionary.
Load a context object from a request environment.
If keyword arguments are provided then they override the values in the request environment.
environ (dict) – The environment dictionary associated with a request.
Return a dictionary of logging specific context attributes.
Return a sensible value for global_id to pass on.
When we want to make a call with to another service, it’s important that we try to use global_request_id if available, and fall back to the locally generated request_id if not.
Return a dictionary of context attributes.
A dictionary of context attributes to enforce policy with.
oslo.policy enforcement requires a dictionary of attributes representing the current logged in user on which it applies policy enforcement. This dictionary defines a standard list of attributes that should be available for enforcement across services.
It is expected that services will often have to override this method with either deprecated values or additional attributes used by that service specific policy.
Store the context in the current thread.
Generate a unique request id.
Create an administrator context.
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.
Return this thread’s current context
If no context is set, returns None
Indicates if the request context is a normal user.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.