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

Fix the mailman_schema example to work with Message.body #135

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 7 additions & 5 deletions docs/sample_schema_package/mailman_schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class BaseMessage(message.Message):

def __str__(self):
"""Return a complete human-readable representation of the message."""
return "Subject: {subj}\n{body}\n".format(subj=self.subject, body=self.body)
return "Subject: {subj}\n{body}\n".format(
subj=self.subject, body=self.email_body
)

@property
def summary(self):
Expand All @@ -42,9 +44,9 @@ def subject(self):
return 'Message did not implement "subject" property'

@property
def body(self):
def email_body(self):
"""The email message body."""
return 'Message did not implement "body" property'
return 'Message did not implement "email_body" property'

@property
def url(self):
Expand Down Expand Up @@ -133,7 +135,7 @@ def subject(self):
return self.body["msg"]["subject"]

@property
def body(self):
def email_body(self):
"""The email message body."""
return self.body["msg"]["body"]

Expand Down Expand Up @@ -187,7 +189,7 @@ def subject(self):
return self.body["subject"]

@property
def body(self):
def email_body(self):
"""The email message body."""
return self.body["body"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_body(self):
"""Assert the message provides a "body" attribute."""
message = self.msg_class(body=self.full_message)

self.assertEqual("hello world", message.body)
self.assertEqual("hello world", message.email_body)

def test_url(self):
"""Assert the message provides a "url" attribute."""
Expand Down