diff options
-rw-r--r-- | python/qpid/datatypes.py | 12 | ||||
-rwxr-xr-x | tools/src/py/qpid-cluster-store | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/python/qpid/datatypes.py b/python/qpid/datatypes.py index fc267c48ef..c37929394c 100644 --- a/python/qpid/datatypes.py +++ b/python/qpid/datatypes.py @@ -308,17 +308,15 @@ except ImportError: def uuid4(): return UUID(random_uuid()) -class UUID: +def parseUUID(str): + fields=str.split("-") + fields[4:5] = [fields[4][:4], fields[4][4:]] + return UUID(struct.pack("!LHHHHL", *[int(x,16) for x in fields])) +class UUID: def __init__(self, bytes): self.bytes = bytes - @staticmethod - def parse(str): - fields=str.split("-") - fields[4:5] = [fields[4][:4], fields[4][4:]] - return UUID(struct.pack("!LHHHHL", *[int(x,16) for x in fields])) - def __cmp__(self, other): if isinstance(other, UUID): return cmp(self.bytes, other.bytes) diff --git a/tools/src/py/qpid-cluster-store b/tools/src/py/qpid-cluster-store index 4599f613d9..0333b371fd 100755 --- a/tools/src/py/qpid-cluster-store +++ b/tools/src/py/qpid-cluster-store @@ -19,7 +19,7 @@ # under the License. # -from qpid.datatypes import uuid4, UUID +from qpid.datatypes import uuid4, UUID, parseUUID import optparse, os.path, sys op = optparse.OptionParser( @@ -39,7 +39,7 @@ class ClusterStoreStatus: def read(self): f = open(self.file) - try: self.cluster_id, self.shutdown_id = [UUID.parse(s) for s in f.readlines()] + try: self.cluster_id, self.shutdown_id = [parseUUID(s) for s in f.readlines()] finally: f.close() def write(self): |