Skip to content

Commit

Permalink
python: add set type for ovs.idl.data.Datum.from_python
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zong Kai LI authored and russellb committed Jul 25, 2016
1 parent 568b9dc commit 38c4437
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/ovs/db/data.py
Expand Up @@ -521,7 +521,7 @@ def from_python(type_, value, row_to_uuid):
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
Expand Down

0 comments on commit 38c4437

Please sign in to comment.