diff options
author | Till Maas <opensource@till.name> | 2015-09-21 20:48:59 +0200 |
---|---|---|
committer | Till Maas <opensource@till.name> | 2015-09-21 20:50:01 +0200 |
commit | c932687adbcac55ea3fd549982496d83f8e600c1 (patch) | |
tree | 140fc445c42255136ad581038882d76c98d12f27 | |
parent | e1bee42cb3428eabb355427a2151d5056578e179 (diff) | |
download | fedora-easy-karma-c932687adbcac55ea3fd549982496d83f8e600c1.tar.gz fedora-easy-karma-c932687adbcac55ea3fd549982496d83f8e600c1.tar.xz fedora-easy-karma-c932687adbcac55ea3fd549982496d83f8e600c1.zip |
Add munc_to_dict() debugging helper
-rwxr-xr-x | fedora-easy-karma.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py index 48acd9f..722d409 100755 --- a/fedora-easy-karma.py +++ b/fedora-easy-karma.py @@ -51,6 +51,18 @@ from fedora.client.bodhi import BodhiClient PROMPT = "Comment? -1/0/1 -> karma, 'i' -> ignore, other -> skip> " +def munch_to_dict(munch): + """ Recursively convert Munch class used in Bodhi2 to dict for easy pretty + printing + """ + if str(munch.__class__) == "<class 'munch.Munch'>": + return dict([(i[0], munch_to_dict(i[1])) for i in munch.items()]) + elif munch.__class__ == list: + return [munch_to_dict(i) for i in munch] + else: + return munch + + class FEK_helper(object): @staticmethod def bodhi_update_str( |