[PATCH 4/6] Utils: fix options serialization

Ondrej Lichtner olichtne at redhat.com
Fri Jun 12 10:36:54 UTC 2015


On Thu, Jun 11, 2015 at 04:32:34PM +0200, olichtne at redhat.com wrote:
> From: Ondrej Lichtner <olichtne at redhat.com>
> 
> Options are stored as tuples which caused problems when serializing them
> for PerfRepo. This needs to be properly fixed by replacing tuples with
> dictionaries but that might cause different problems elsewhere so for
> now I'm submitting this temporary fix.
> 
> Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>
> ---
>  lnst/Common/Utils.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
> index 39c851f..8e5c5af 100644
> --- a/lnst/Common/Utils.py
> +++ b/lnst/Common/Utils.py
> @@ -229,6 +229,10 @@ def list_to_dot(original_list, prefix="", key=""):
>              return_list.extend(sub_list)
>          elif isinstance(value, list):
>              raise Exception("Nested lists not allowed")
> +        elif isinstance(value, tuple):
> +            #TODO temporary fix, tuples shouldn't be here
> +            if len(value) == 2:
> +            return_list.append((iter_key+'.'+value[0], value[1]))

The line above should be indented, I'll resend the patchset with the fix

>          else:
>              return_list.append((iter_key, value))
>      return return_list
> @@ -242,6 +246,10 @@ def dict_to_dot(original_dict, prefix=""):
>          elif isinstance(value, list):
>              sub_list = list_to_dot(value, prefix, key)
>              return_list.extend(sub_list)
> +        elif isinstance(value, tuple):
> +            #TODO temporary fix, tuples shouldn't be here
> +            if len(value) == 2:
> +                return_list.append((iter_key+'.'+value[0], value[1]))
>          else:
>              return_list.append((prefix+key, str(value)))
>      return return_list
> -- 
> 2.1.0
> 


More information about the LNST-developers mailing list