Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

#8083 closed defect (fixed)

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

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

Description (last modified by Remy Blank)

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 (0)

Change History (3)

comment:1 by Remy Blank, 11 years ago

Description: modified (diff)
Owner: changed from Emmanuel Blot to Remy Blank

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

in reply to:  1 comment:2 by Emmanuel Blot, 11 years ago

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 by Remy Blank, 11 years ago

Keywords: python26 added
Resolution: fixed
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.