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.

Depends-On: Ib143f8a5c129dbf6711800c4d87c8830a8aa3365
Change-Id: I922f2e4544de6eb3bddb134ccd87a3bafa5e6c08
This commit is contained in:
Ben Nemec 2017-10-10 20:44:24 +00:00 committed by Graham Hayes
parent 434a625a29
commit 3db4f09b56

View File

@ -33,6 +33,10 @@ class DesignateContext(context.RequestContext):
original_tenant = None
_edit_managed_records = False
_client_addr = None
FROM_DICT_EXTRA_KEYS = [
'original_tenant', 'service_catalog', 'all_tenants', 'abandon',
'edit_managed_records', 'tsigkey_id', 'hide_counts', 'client_addr',
]
def __init__(self, service_catalog=None, all_tenants=False, abandon=None,
tsigkey_id=None, original_tenant=None,
@ -90,14 +94,6 @@ class DesignateContext(context.RequestContext):
return copy.deepcopy(d)
@classmethod
def from_dict(cls, values):
extra_keys = ['original_tenant', 'service_catalog', 'all_tenants',
'abandon', 'edit_managed_records', 'tsigkey_id',
'hide_counts', 'client_addr']
kwargs = {k: values[k] for k in extra_keys}
return super(DesignateContext, cls).from_dict(values, **kwargs)
def elevated(self, show_deleted=None, all_tenants=False,
edit_managed_records=False):
"""Return a version of this context with admin flag set.