From 9c4d5e8bbe82ec2c9bdfaf508f6d39f9d2f435d5 Mon Sep 17 00:00:00 2001 From: anxdpanic Date: Mon, 18 Nov 2019 10:33:35 -0500 Subject: [PATCH 1/2] fix md5 generation on python 3 --- resources/lib/storage_server/StorageServer.py | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/resources/lib/storage_server/StorageServer.py b/resources/lib/storage_server/StorageServer.py index 66a4234..68d11d2 100644 --- a/resources/lib/storage_server/StorageServer.py +++ b/resources/lib/storage_server/StorageServer.py @@ -33,6 +33,11 @@ except ImportError: sqlite = None +try: + basestring +except NameError: + basestring = str + PY3 = sys.version_info[0] >= 3 @@ -522,14 +527,37 @@ def _generateKey(self, funct, *args): if isinstance(params, dict): for key in sorted(params.keys()): if key not in ["new_results_function"]: - keyhash.update("'%s'='%s'" % (key, params[key])) + val = params[key] + if not isinstance(val, basestring): + val = str(val) + if PY3: + if isinstance(key, str): + key = key.encode('utf-8') + if isinstance(val, str): + val = val.encode('utf-8') + key_val_pair = b"'%s'='%s'" % (key, val) + else: + key_val_pair = "'%s'='%s'" % (key, val) + keyhash.update(key_val_pair) elif isinstance(params, list): - keyhash.update(",".join(["%s" % el for el in params])) + if PY3: + hash_list = [] + for el in params: + if not isinstance(el, basestring): + el = str(el) + if isinstance(el, str): + el = el.encode('utf-8') + hash_list.append(el) + keyhash.update(b",".join([b"%s" % el for el in hash_list])) + else: + keyhash.update(",".join(["%s" % el for el in params])) else: - try: - keyhash.update(params) - except: - keyhash.update(str(params)) + if not isinstance(params, basestring): + params = str(params) + if PY3: + if isinstance(params, str): + params = params.encode('utf-8') + keyhash.update(params) name += "|" + keyhash.hexdigest() + "|" From eb32ad79c9bbc363a16a73cfa6d1ad8773f6ce1f Mon Sep 17 00:00:00 2001 From: anxdpanic Date: Mon, 18 Nov 2019 10:34:46 -0500 Subject: [PATCH 2/2] 2.6.0~alpha2 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 97d174d..e8288b6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - +