[ovs-dev] [PATCH] test-ovsdb: Fix conditional statement.

Russell Bryant rbryant at redhat.com
Wed Apr 29 18:37:43 UTC 2015


On 04/29/2015 01:45 PM, Alex Wang wrote:
> Old version of python does not support the following conditional
> statement syntax in one assignment:
> 
>    var = value1 if cond1 else value2
> 
> This commit fixes it by convert it back to use two assignments.
> 
> Signed-off-by: Alex Wang <alexw at nicira.com>

The code looks fine, so:

Acked-by: Russell Bryant <rbryant at redhat.com>

... but what system are you still supporting that doesn't have this?  It
looks like it was added in Python 2.5.  So, RHEL 5 or some derivative?
or something else?  Just curious ...

> ---
>  tests/test-ovsdb.py |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
> index 250f671..4f8d7ca 100644
> --- a/tests/test-ovsdb.py
> +++ b/tests/test-ovsdb.py
> @@ -240,7 +240,10 @@ def idl_set(idl, commands, step):
>              old_notify = idl.notify
>  
>              def notify(event, row, updates=None):
> -                upcol = updates._data.keys()[0] if updates else None
> +                if updates:
> +                    upcol = updates._data.keys()[0]
> +                else:
> +                    upcol = None
>                  events.append("%s|%s|%s" % (event, row.i, upcol))
>                  idl.notify = old_notify
>  
> 


-- 
Russell Bryant



More information about the dev mailing list