Skip to content

Commit 23e696b

Browse files
authored
chore: remove logic adding quotes to names containing , and ; (#994)
1 parent 2ac1dcb commit 23e696b

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

sendgrid/helpers/mail/email.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@
33
except ImportError:
44
import email.utils as rfc822
55

6-
import sys
7-
if sys.version_info[:3] >= (3, 5, 0):
8-
import html
9-
html_entity_decode = html.unescape
10-
else:
11-
try:
12-
# Python 2.6-2.7
13-
from HTMLParser import HTMLParser
14-
except ImportError:
15-
# Python < 3.5
16-
from html.parser import HTMLParser
17-
__html_parser__ = HTMLParser()
18-
html_entity_decode = __html_parser__.unescape
19-
206
try:
217
basestring = basestring
228
except NameError:
@@ -91,11 +77,6 @@ def name(self, value):
9177
if not (value is None or isinstance(value, basestring)):
9278
raise TypeError('name must be of type string.')
9379

94-
# Escape common CSV delimiters as workaround for
95-
# https://github.com/sendgrid/sendgrid-python/issues/578
96-
if value is not None and (',' in value or ';' in value):
97-
value = html_entity_decode(value)
98-
value = '"' + value + '"'
9980
self._name = value
10081

10182
@property

test/test_email.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,3 @@ def test_empty_obj_add_email(self):
6666
email.email = address
6767

6868
self.assertEqual(email.email, address)
69-
70-
def test_add_name_with_comma(self):
71-
email = Email()
72-
name = "Name, Some"
73-
email.name = name
74-
75-
self.assertEqual(email.name, '"' + name + '"')
76-
77-
def test_add_unicode_name_with_comma(self):
78-
email = Email()
79-
name = u"Name, Some"
80-
email.name = name
81-
82-
self.assertEqual(email.name, u'"' + name + u'"')

0 commit comments

Comments
 (0)