Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Encode name on Python2.x
Pacu2fc0f70402054
diff --git a/saleor/core/analytics.py b/saleor/core/analytics.pyindex e6f7de083b..2cceac8cb1 100644--- a/saleor/core/analytics.py+++ b/saleor/core/analytics.py@@ -4,6 +4,7 @@ from __future__ import unicode_literalsimport uuidimport google_measurement_protocol as ga+import sixfrom django.conf import settingsFINGERPRINT_PARTS = [@@ -18,9 +19,12 @@ UUID_NAMESPACE = uuid.UUID('fb4abc05-e2fb-4e3e-8b78-28037ef7d07f')def get_client_id(request):parts = [request.META.get(key, '') for key in FINGERPRINT_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)))+ name = '_'.join(parts)+ # In Python2 name is unicode type+ # We encode it to avoid UnicodeDecodeError in uuid package+ if six.PY2:+ name = name.encode('utf-8')+ return uuid.uuid5(UUID_NAMESPACE, name)def _report(client_id, what, extra_info=None, extra_headers=None):diff --git a/saleor/dashboard/group/views.py b/saleor/dashboard/group/views.pyindex 3334e4df1f..d52508579b 100644--- a/saleor/dashboard/group/views.py+++ b/saleor/dashboard/group/views.py@@ -9,6 +9,7 @@ from django.template.response import TemplateResponsefrom django.utils.translation import pgettext_lazyfrom ...core.utils import get_paginator_items+from ..views import staff_member_requiredfrom .forms import GroupPermissionsForm