Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add explanatory to workaround of differences between Python2 and Python3

Pacu2bf054017f03b
diff --git a/saleor/core/analytics.py b/saleor/core/analytics.py
index 03707ba500..e6f7de083b 100644
--- a/saleor/core/analytics.py
+++ b/saleor/core/analytics.py
@@ -18,8 +18,9 @@ UUID_NAMESPACE = uuid.UUID('fb4abc05-e2fb-4e3e-8b78-28037ef7d07f')
def get_client_id(request):
parts = [request.META.get(key, '') for key in FINGERPRINT_PARTS]
- encoded_parts = '_'.join(parts).encode('utf_8')
- return uuid.uuid5(UUID_NAMESPACE, str(encoded_parts))
+ # In Python2 parts are unicode type
+ # We transform it to str to avoid UnicodeDecodeError in uuid package
+ return uuid.uuid5(UUID_NAMESPACE, str('_'.join(parts)))
def _report(client_id, what, extra_info=None, extra_headers=None):