Call base from_dict in RequestContext

This changes the from_dict override to call the base class
implementation with the Congress-specific keys passed as kwargs.
It should prevent issues where a new key is added to the base to_dict
function that is not an accepted parameter on the constructor.

Change-Id: I271111f1fe2ba0d4350e94f672abd327ac8eeb7a
Closes-Bug: 1721432
This commit is contained in:
Ben Nemec 2017-10-10 17:33:39 +00:00
parent a729a0926d
commit b40fcbecf4
1 changed files with 4 additions and 1 deletions

View File

@ -124,7 +124,10 @@ class RequestContext(common_context.RequestContext):
@classmethod
def from_dict(cls, values):
return 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."""