Skip to content

Commit

Permalink
Fix the mailman_schema example to work with Message.body
Browse files Browse the repository at this point in the history
The message ``body`` variable is used by the Message class, but the
example schema is still defining a property using that name.

See https://pagure.io/fedora-commops/fedora-happiness-packets/issue/96

Signed-off-by: Jeremy Cline <jcline@redhat.com>
  • Loading branch information
jeremycline committed Feb 27, 2019
1 parent 81dd4f5 commit 5b02d1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions docs/sample_schema_package/mailman_schema/schema.py
Expand Up @@ -29,7 +29,7 @@ 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 +42,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 +133,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 +187,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
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

0 comments on commit 5b02d1f

Please sign in to comment.