Skip to content

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

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

Closed
dpapavas opened this issue Jan 25, 2017 · 2 comments
Closed
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@dpapavas
Copy link

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
@thinkingserious thinkingserious added status: help wanted requesting help from the community type: bug bug in the library labels Jan 25, 2017
@thinkingserious
Copy link
Contributor

Thanks @dpapavas!

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

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap and removed type: bug bug in the library labels Apr 28, 2017
@diegoc-am
Copy link
Contributor

Created pull request #338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

3 participants