Modify

Opened 7 years ago

Closed 7 years ago

#6443 closed defect (fixed)

EmailDistributor does not work for tickects with non-Ascii names

Reported by: dbely Owned by: Robert Corsaro
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords:
Cc: uvolodia@… Trac Release: 0.11

Description

AnnouncerPlugin (latest trunk r7413) fails while sending e-mail notification when the ticket's name is non-Ascii:

2010-01-18 18:41:47,439 Trac[email_distributor] DEBUG: EmailDistributor is sending event as 'text/html' to: someone@somethere.com
2010-01-18 18:41:47,545 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/announcerplugin/api.py", line 369, in _real_send
    distributor.distribute(transport, packages[transport], evt)
  File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 227, in distribute
    self._do_send(transport, event, k, v, fmtdict[k])
  File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 346, in _do_send
    subject = "%s %s"%(prefix, subject)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 12: ordinal not in range(128)
2010-01-18 18:41:47,546 Trac[api] DEBUG: AnnouncementSystem sent event in 0.12 seconds.

If I'm not mistaken, the problem is that in

    subject = "%s %s"%(prefix, subject)

prefix is a unicode object but subjects is a string (utf-8?). So formatting operator try tries to convert the latter to unicode and fails.

The bug seems to be trivial but I am not familiar enough with AnnouncerPlugin's internals to propose a working fix myself.

Attachments (1)

unicode_subject-0.patch (2.7 KB) - added by Robert Corsaro 7 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 7 years ago by uvolodia@…

Для себя решил проблему так: subject = "%s %s"%(prefix, to_unicode(subject))

comment:2 Changed 7 years ago by anonymous

Cc: uvolodia@… added; anonymous removed

comment:3 Changed 7 years ago by Robert Corsaro

Owner: changed from Stephen Hansen to Robert Corsaro

comment:4 Changed 7 years ago by Robert Corsaro

Resolution: fixed
Status: newclosed

Fixed in r7683

comment:5 Changed 7 years ago by dbely

Resolution: fixed
Status: closedreopened

Please also fix it in 0.11dev branch

comment:6 Changed 7 years ago by anonymous

Resolution: fixed
Status: reopenedclosed

comment:7 Changed 7 years ago by dbely

Resolution: fixed
Status: closedreopened

I'm sorry it's not fixed yet in 0.11dev. Why did you close the ticket? (BTW, why anonymous have rights to do that?)

comment:8 Changed 7 years ago by Robert Corsaro

it wasn't me. I'll work on getting this patch merged to 0.11dev

Changed 7 years ago by Robert Corsaro

Attachment: unicode_subject-0.patch added

comment:9 Changed 7 years ago by Robert Corsaro

Can you give the attached patch a whirl and if it works I'll commit it?

comment:10 in reply to:  9 Changed 7 years ago by dbely

Yes, it works OK. Please commit. Thanks!

comment:11 Changed 7 years ago by Robert Corsaro

Resolution: fixed
Status: reopenedclosed

Done in r7874. Thanks for testing.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Robert Corsaro.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.