Skip to content

Commit 71cf177

Browse files
committed
Fix processing of multiple 'to_name' unicode objects.
Currently, the method sendgrid.message.Mail.add_to_name only encodes singular unicode object 'to_name' names to Python str objects. Lists of multiple unicode objects passed into the aforementioned method does not elicit the same encoding process. This commit fixes that.
1 parent 64eaec3 commit 71cf177

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sendgrid/message.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def add_to_name(self, to_name):
7272
elif sys.version_info < (3, 0) and isinstance(to_name, unicode):
7373
self.to_name.append(to_name.encode('utf-8'))
7474
elif hasattr(to_name, '__iter__'):
75-
self.to_name = self.to_name + to_name
75+
for tn in to_name:
76+
self.add_to_name(tn)
7677

7778
def add_cc(self, cc):
7879
if isinstance(cc, str):

0 commit comments

Comments
 (0)