Merge "Ensure context type is handled when using to_dict"

This commit is contained in:
Jenkins 2013-12-05 09:27:48 +00:00 committed by Gerrit Code Review
commit 3a2287c9e6
1 changed files with 7 additions and 2 deletions

View File

@ -299,8 +299,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)