Simplify that.
This commit is contained in:
parent
e7eb813578
commit
e49e25873c
1 changed files with 9 additions and 10 deletions
|
@ -148,15 +148,14 @@ def send_message(cbtype, *args, **kws):
|
||||||
# rhel and fedora.
|
# rhel and fedora.
|
||||||
problem_fields = ['weight', 'start_ts', 'create_ts', 'completion_ts']
|
problem_fields = ['weight', 'start_ts', 'create_ts', 'completion_ts']
|
||||||
def scrub(obj):
|
def scrub(obj):
|
||||||
if not isinstance(obj, dict):
|
if isinstance(obj, list):
|
||||||
return
|
return [scrub(item) for item in obj]
|
||||||
for key in obj:
|
if isinstance(obj, dict):
|
||||||
if key in problem_fields:
|
return dict([
|
||||||
del obj[key]
|
(k, scrub(v)) for k, v in obj.items() if k not in problem_fields
|
||||||
if isinstance(obj[key], list):
|
])
|
||||||
[scrub(item) for item in obj]
|
return obj
|
||||||
if isinstance(obj[key], dict):
|
|
||||||
[scrub(obj[key]) for key in obj]
|
body = scrub(body)
|
||||||
scrub(body)
|
|
||||||
|
|
||||||
fedmsg.publish(topic=topic, msg=body, modname='buildsys')
|
fedmsg.publish(topic=topic, msg=body, modname='buildsys')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue