From: Sumit Garg Date: Thu, 25 Jun 2015 15:51:42 +0000 (-0700) Subject: python: Fix writing to non-"alert" column for newly inserted row. X-Git-Tag: v2.4.0~70 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=e2695ccb9c8d16cfc41925ef9c780b79ba1cd25d python: Fix writing to non-"alert" column for newly inserted row. When 'alert' was turned off on a column, the code was erroring out when value for that column was being set in a newly inserted row. This is because the row._data was None at this time. It seems that new rows are not initialized to defaults and that's why the NULL error happens. IMO a newly inserted row should automatically get intialized to default values. This new behavior can be implemented as a separate improvement sometime in the future. For now, I don't see an issue with adding the additional check. This new check can continue as-is even after the new behavior is implemented. Signed-off-by: Sumit Garg Signed-off-by: Ben Pfaff --- diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index a6584a8e6..f074dbfce 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -1074,7 +1074,7 @@ class Transaction(object): # transaction only does writes of existing values, without making any # real changes, we will drop the whole transaction later in # ovsdb_idl_txn_commit().) - if not column.alert and row._data.get(column.name) == datum: + if not column.alert and row._data and row._data.get(column.name) == datum: new_value = row._changes.get(column.name) if new_value is None or new_value == datum: return