From ec3c44a808bf5f3f4c32ce0bbda943c75a890632 Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Wed, 8 Jun 2016 14:26:29 +0200 Subject: [PATCH 1/3] fix unicode err in vcard download --- aldryn_people/models.py | 2 +- aldryn_people/vcard.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aldryn_people/models.py b/aldryn_people/models.py index 1e5deda..a7a0a67 100644 --- a/aldryn_people/models.py +++ b/aldryn_people/models.py @@ -330,7 +330,7 @@ def get_vcard(self, request=None): if self.primary_group.website: vcard.add_line('URL', self.primary_group.website) - return str(vcard) + return unicode(vcard) @python_2_unicode_compatible diff --git a/aldryn_people/vcard.py b/aldryn_people/vcard.py index 6250621..3f0d231 100644 --- a/aldryn_people/vcard.py +++ b/aldryn_people/vcard.py @@ -18,7 +18,7 @@ def add_line(self, key, value, **params): else: value = ';'.join(self.__escape(x) for x in value) - line = '{0}:{1}'.format(key_and_params, value) + line = u'{0}:{1}'.format(key_and_params, value) self.lines.append(line) def __escape(self, value): From 7445bc5261f159b9c251268a6c0dd93700e80d8d Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Wed, 8 Jun 2016 14:57:30 +0200 Subject: [PATCH 2/3] python3 fix --- aldryn_people/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aldryn_people/models.py b/aldryn_people/models.py index a7a0a67..a87ec92 100644 --- a/aldryn_people/models.py +++ b/aldryn_people/models.py @@ -330,6 +330,9 @@ def get_vcard(self, request=None): if self.primary_group.website: vcard.add_line('URL', self.primary_group.website) + if six.PY2: + vcard = unicode(vcard) + return unicode(vcard) From 547d3a6f40996e8e215ed787298b28eb4df8c8fb Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Wed, 8 Jun 2016 14:59:20 +0200 Subject: [PATCH 3/3] deleted redundant unicode() --- aldryn_people/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aldryn_people/models.py b/aldryn_people/models.py index a87ec92..bb55b85 100644 --- a/aldryn_people/models.py +++ b/aldryn_people/models.py @@ -333,7 +333,7 @@ def get_vcard(self, request=None): if six.PY2: vcard = unicode(vcard) - return unicode(vcard) + return vcard @python_2_unicode_compatible