On 08/17/2011 11:20 PM, Dale Curtis wrote:
> The current parser converts reasons with an = sign in them into optional
> fields. To prevent this I've added a check to make sure keys match the
> pattern "^\w+=.+".

LGTM, applied, thanks:

http://autotest.kernel.org/changeset/5531

> Signed-off-by: Dale Curtis<[email protected]>
> ---
>   tko/parsers/version_0.py |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tko/parsers/version_0.py b/tko/parsers/version_0.py
> index ed12cb4..45ca44d 100644
> --- a/tko/parsers/version_0.py
> +++ b/tko/parsers/version_0.py
> @@ -270,11 +270,11 @@ class status_line(object):
>           # a non-matching part, treat it and the rest of the parts as the 
> reason.
>           optional_fields = {}
>           while part_index<  len(parts):
> -            kv = parts[part_index].split('=', 1)
> -            if len(kv)<  2:
> +            kv = re.search(r"^(\w+)=(.+)", parts[part_index])
> +            if not kv:
>                   break
>
> -            optional_fields[kv[0]] = kv[1]
> +            optional_fields[kv.group(1)] = kv.group(2)
>               part_index += 1
>
>           reason = "\t".join(parts[part_index:])

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to