mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
python/ovs/ovsuuid: Fix behavior of UUID.from_json() with no symbol table.
UUID.from_json(['named-uuid', 'x'], None) should raise an error about invalid syntax, but instead it was raising a TypeError because it would try to evaluate "'x' not in None". This fixes the problem and adds a test.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2009, 2010 Nicira Networks
|
||||
# Copyright (c) 2009, 2010, 2011 Nicira Networks
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -51,6 +51,8 @@ class UUID(uuid.UUID):
|
||||
raise error.Error("\"%s\" is not a valid UUID" % s, json)
|
||||
return UUID(s)
|
||||
except error.Error, e:
|
||||
if not symtab:
|
||||
raise e
|
||||
try:
|
||||
name = ovs.db.parser.unwrap_json(json, "named-uuid", unicode)
|
||||
except error.Error:
|
||||
|
||||
Reference in New Issue
Block a user