2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

python: add set type for ovs.idl.data.Datum.from_python

ovs.db.idl.Datum.from_python fails to handle set type value, while set
type is also a common iterable sequence, just like list and tuple.
No reason IDL caller must to turn set type parameters to list or tuple
type. Otherwise, they will fail to insert data, but get no exception.

Reported-at: https://bugs.launchpad.net/networking-ovn/+bug/1605573
Signed-off-by: Zong Kai LI <zealokii@gmail.com>
Acked-by: Richard Theis <rtheis@us.ibm.com>
Tested-by: Richard Theis <rtheis@us.ibm.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
Zong Kai LI
2016-07-21 14:17:28 +08:00
committed by Russell Bryant
parent 568b9dc887
commit 38c4437843

View File

@@ -521,7 +521,7 @@ class Datum(object):
ka = Atom.from_python(type_.key, row_to_uuid(k))
va = Atom.from_python(type_.value, row_to_uuid(v))
d[ka] = va
elif isinstance(value, (list, tuple)):
elif isinstance(value, (list, set, tuple)):
for k in value:
ka = Atom.from_python(type_.key, row_to_uuid(k))
d[ka] = None