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

Lines changed: 6 additions & 2 deletions
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='templates@sendgrid.com')
229+
mail = Mail()
230+
mail.from_email = 'templates@sendgrid.com'
230231
mail.template_id = 'd-your-dynamic-template-uid'
231232
p = Personalization()
232233
p.add_to(Email('user@example.com'))
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

Lines changed: 14 additions & 2 deletions
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('test@sendgrid.com'))
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': 'test@sendgrid.com'}],
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

Lines changed: 2 additions & 1 deletion
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='templates@example.com')
88+
mail = Mail()
89+
mail.from_email='templates@example.com'
8990
mail.template_id = 'd-your-dynamic-template-uid'
9091
p = Personalization()
9192
p.add_to(Email('user@example.com'))

0 commit comments

Comments
 (0)