Edgewall Software
Modify

Ticket #8083 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Email notifications don't work with Python 2.6: "TypeError: character mapping must return integer, None or unicode""

Reported by: trac@… Owned by: rblank
Priority: high Milestone: 0.11.4
Component: notification Version: none
Severity: critical Keywords: python26
Cc:
Release Notes:
API Changes:

Description (last modified by rblank) (diff)

When email notification is attempted to be sent with Python 2.6 the following exception is generated:

2009-02-20 20:29:35,839 Trac[web_ui] ERROR: Failure sending notification on change to ticket #39:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/trac/ticket/web_ui.py", line 1017, in _do_save
    tn.notify(ticket, newticket=False, modtime=now)
  File "/usr/lib64/python2.6/site-packages/trac/ticket/notification.py", line 151, in notify
    NotifyEmail.notify(self, ticket.id, subject)
  File "/usr/lib64/python2.6/site-packages/trac/notification.py", line 246, in notify
    Notify.notify(self, resid)
  File "/usr/lib64/python2.6/site-packages/trac/notification.py", line 134, in notify
    self.begin_send()
  File "/usr/lib64/python2.6/site-packages/trac/notification.py", line 328, in begin_send
    self.server.login(self.user_name, self.password)
  File "/usr/lib64/python2.6/smtplib.py", line 574, in login
    (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
  File "/usr/lib64/python2.6/smtplib.py", line 538, in encode_cram_md5
    response = user + " " + hmac.HMAC(password, challenge).hexdigest()
  File "/usr/lib64/python2.6/hmac.py", line 72, in __init__
    self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode

This is related to bug in HMAC library: http://bugs.python.org/issue5285

But login and password should not be sent to HMAC as unicode strings anyway.

Attachments

Change History

comment:1 follow-up: Changed 3 years ago by rblank

  • Description modified (diff)
  • Owner changed from eblot to rblank

I'd like to look into that, Manu, I hope you don't mind.

comment:2 in reply to: ↑ 1 Changed 3 years ago by eblot

Replying to rblank:

I'd like to look into that, Manu, I hope you don't mind.

Nope. Feel free to fix any ticket related to the notification as well. I'm sorry I have no time to work on Trac for now ;-(

comment:3 Changed 3 years ago by rblank

  • Keywords python26 added
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [7915] by encoding user_name and password as utf-8 prior to passing them to server.login().

Thanks Victor for the precise bug report.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from rblank. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.