Use oslo.context from_dict unmodified
With the change to oslo.context in the depends-on, we no longer need to maintain an override for the from_dict function. We only need to provide a list of additional keys in the appropriate class member. This will work with oslo.context 2.19.2 and above, which is now the minimum version in global-requirements. Depends-On: Ib143f8a5c129dbf6711800c4d87c8830a8aa3365 Change-Id: If09a3b22465b196baa34edc00c7472f5feed4ba5
This commit is contained in:
parent
250fa0c3e8
commit
ceb4bb6ea8
|
@ -36,6 +36,10 @@ class RequestContext(common_context.RequestContext):
|
|||
Represents the user taking a given action within the system.
|
||||
|
||||
"""
|
||||
FROM_DICT_EXTRA_KEYS = [
|
||||
'user_id', 'tenant_id', 'project_id', 'read_deleted', 'timestamp',
|
||||
'tenant_name', 'project_name', 'user_name',
|
||||
]
|
||||
|
||||
def __init__(self, user_id, tenant_id, is_admin=None, read_deleted="no",
|
||||
roles=None, timestamp=None, load_admin_roles=True,
|
||||
|
@ -122,13 +126,6 @@ class RequestContext(common_context.RequestContext):
|
|||
'user_name': self.user_name})
|
||||
return ret
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, values):
|
||||
extra_keys = ['user_id', 'tenant_id', 'project_id', 'read_deleted',
|
||||
'timestamp', 'tenant_name', 'project_name', 'user_name']
|
||||
kwargs = {k: values[k] for k in extra_keys}
|
||||
return super(RequestContext, cls).from_dict(values, **kwargs)
|
||||
|
||||
def elevated(self, read_deleted=None):
|
||||
"""Return a version of this context with admin flag set."""
|
||||
context = copy.copy(self)
|
||||
|
|
Loading…
Reference in New Issue