Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove logic adding quotes to names containing , and ; #994

Merged
merged 4 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions sendgrid/helpers/mail/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ def name(self, value):
if not (value is None or isinstance(value, basestring)):
raise TypeError('name must be of type string.')

# Escape common CSV delimiters as workaround for
# https://github.com/sendgrid/sendgrid-python/issues/578
if value is not None and (',' in value or ';' in value):
value = html_entity_decode(value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can drop all the html_entity_decode import stuff at the top of the file.

value = '"' + value + '"'
self._name = value

@property
Expand Down
14 changes: 0 additions & 14 deletions test/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,3 @@ def test_empty_obj_add_email(self):
email.email = address

self.assertEqual(email.email, address)

def test_add_name_with_comma(self):
email = Email()
name = "Name, Some"
email.name = name

self.assertEqual(email.name, '"' + name + '"')

def test_add_unicode_name_with_comma(self):
email = Email()
name = u"Name, Some"
email.name = name

self.assertEqual(email.name, u'"' + name + u'"')