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

TypeError exception (get Lazy instead of str or unicode) when sending mail on GAE #963

Closed
matclab opened this issue May 9, 2015 · 2 comments

Comments

@matclab
Copy link

matclab commented May 9, 2015

Sending a mail with body containing translated strings resulted in the following exception :

Traceback (most recent call last):
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/applications/foundit/controllers/default.py", line 127, in <module>
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/globals.py", line 393, in <lambda>
    self._caller = lambda f: f()
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/applications/foundit/controllers/default.py", line 34, in user
    return dict(form=auth())
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/tools.py", line 1595, in __call__
    return getattr(self, args[0])()
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/tools.py", line 3272, in request_reset_password
    if self.email_reset_password(user):
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/tools.py", line 3296, in email_reset_password
    message=self.messages.reset_password % d):
  File "/base/data/home/apps/e~sacred-bonus-88417/1.384178859090314065/gluon/tools.py", line 798, in send
    subject=subject, body=text, **xcc)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/mail.py", line 402, in send_mail
    message.send(make_sync_call=make_sync_call)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/mail.py", line 1108, in send
    message = self.ToProto()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/mail.py", line 1350, in ToProto
    message = super(EmailMessage, self).ToProto()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/mail.py", line 1046, in ToProto
    message.set_subject(_to_str(self.subject))
  File "cpp_message.pyx", line 124, in cpp_message.SetScalarAccessors.Setter (third_party/apphosting/python/protobuf/proto1/cpp_message.cc:2229)
TypeError: <class 'gluon.languages.lazyT'> has type <class 'gluon.languages.lazyT'>, but expected one of: str, unicode
mdipierro added a commit that referenced this issue May 14, 2015
#963 : Convert subject and body to unicode before sending mail
@ilvalle
Copy link
Contributor

ilvalle commented May 15, 2015

@matclab can the issue be closed?

@mdipierro
Copy link
Contributor

yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants