Skip to content

The __str__ method of the Mail class, doesn't actually return anything #292

Closed

Description

@dpapavas

Issue Summary

The __str__ method of the Mail class, doesn't actually return anything, hence trying something like logging.debug("Mail: %s\n", some_mail), where some_mail is an instance of the Mail class, will result in an exception.

Steps to Reproduce

  1. Instantiate the Mail class
  2. Print the instance

This will result in a TypeError exception:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-119834a39903> in <module>()
----> 1 print(message)

TypeError: __str__ returned non-string (type NoneType)

One possible fix would be to replace

    def __str__(self):
        self.get()

with

    def __str__(self):
        return str(self.get())

Technical details:

  • sendgrid-python Version: master (latest commit: [bdba194])
  • Python Version: 2.7

Activity

  1. thinkingserious commented on Jan 25, 2017

    @thinkingserious
    Contributor

    Thanks @dpapavas!

    I've added this to our backlog for a fix.

  2. diegoc-am commented on Aug 30, 2017

    @diegoc-am
    Contributor

    Created pull request #338

  3. added a commit that references this issue on Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions