X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fovsuuid.py;h=56fdad05ee55ade305cc026167557a62ffaa053c;hb=6dc2f8eeada4e4e1b1fc29d69cb7cbdf1cd94061;hp=df4f1fd769644127513e1060ad226a1c8bb19917;hpb=49c541dc1193528ff1a5f68ed7a69d3ddd4a00be;p=openvswitch diff --git a/python/ovs/ovsuuid.py b/python/ovs/ovsuuid.py index df4f1fd7..56fdad05 100644 --- a/python/ovs/ovsuuid.py +++ b/python/ovs/ovsuuid.py @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2010, 2011 Nicira Networks +# Copyright (c) 2009, 2010, 2011 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import ovs.db.parser uuidRE = re.compile("^xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx$" .replace('x', '[0-9a-fA-F]')) + def zero(): return uuid.UUID(int=0) @@ -37,7 +38,7 @@ def from_string(s): def from_json(json, symtab=None): try: - s = ovs.db.parser.unwrap_json(json, "uuid", unicode) + s = ovs.db.parser.unwrap_json(json, "uuid", [str, unicode], "string") if not uuidRE.match(s): raise error.Error("\"%s\" is not a valid UUID" % s, json) return uuid.UUID(s) @@ -45,12 +46,13 @@ def from_json(json, symtab=None): if not symtab: raise e try: - name = ovs.db.parser.unwrap_json(json, "named-uuid", unicode) + name = ovs.db.parser.unwrap_json(json, "named-uuid", + [str, unicode], "string") except error.Error: raise e if name not in symtab: - symtab[name] = uuid4() + symtab[name] = uuid.uuid4() return symtab[name]