Ensure context type is handled when using to_dict
Handle the case where the context passed into def pack_context() is a dictionary. If a dictionary is passed in, we don't need to call to_dict before updating the msg. Closes-Bug: #1208971 Change-Id: I2ce0b28f97634e717868e0ee5525189338d4981c
This commit is contained in:
parent
fda06f6806
commit
d04fab6985
@ -301,8 +301,13 @@ def pack_context(msg, context):
|
||||
for args at some point.
|
||||
|
||||
"""
|
||||
context_d = dict([('_context_%s' % key, value)
|
||||
for (key, value) in context.to_dict().iteritems()])
|
||||
if isinstance(context, dict):
|
||||
context_d = dict([('_context_%s' % key, value)
|
||||
for (key, value) in context.iteritems()])
|
||||
else:
|
||||
context_d = dict([('_context_%s' % key, value)
|
||||
for (key, value) in context.to_dict().iteritems()])
|
||||
|
||||
msg.update(context_d)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user