Skip to content

Commit e1cc256

Browse files
committed
minor formatting
1 parent 8ff82a8 commit e1cc256

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

examples/helpers/mail_example.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,15 @@ def dynamic_template_usage():
226226
<p>Hello, {{name}}! Your current balance is {{balance}}<p>
227227
228228
"""
229-
mail = Mail(from_email='[email protected]')
229+
mail = Mail()
230+
mail.from_email = '[email protected]'
230231
mail.template_id = 'd-your-dynamic-template-uid'
231232
p = Personalization()
232233
p.add_to(Email('[email protected]'))
233-
p.dynamic_template_data = {'name': 'Bob', 'balance': 42}
234+
p.dynamic_template_data = {
235+
'name': 'Bob',
236+
'balance': 42
237+
}
234238
mail.add_personalization(p)
235239

236240
sg = SendGridAPIClient(apikey='SG.your-api-key')

test/test_mail.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,22 @@ def test_directly_setting_substitutions(self):
565565
def test_dynamic_template_data(self):
566566
p = Personalization()
567567
p.add_to(Email('[email protected]'))
568-
p.dynamic_template_data = {'customer': {'name': 'Bob', 'returning': True}, 'total': 42}
568+
p.dynamic_template_data = {
569+
'customer': {
570+
'name': 'Bob',
571+
'returning': True
572+
},
573+
'total': 42
574+
}
569575

570576
expected = {
571577
'to': [{'email': '[email protected]'}],
572-
'dynamic_template_data': {'customer': {'name': 'Bob', 'returning': True}, 'total': 42}
578+
'dynamic_template_data': {
579+
'customer': {
580+
'name': 'Bob',
581+
'returning': True
582+
},
583+
'total': 42
584+
}
573585
}
574586
self.assertDictEqual(p.get(), expected)

use_cases/transational_templates.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ from sendgrid.helpers.mail import Email, Personalization
8585

8686
sg = SendGridAPIClient(apikey='SG.your-api-key')
8787

88-
mail = Mail(from_email='[email protected]')
88+
mail = Mail()
89+
mail.from_email='[email protected]'
8990
mail.template_id = 'd-your-dynamic-template-uid'
9091
p = Personalization()
9192
p.add_to(Email('[email protected]'))

0 commit comments

Comments
 (0)