Modify

Opened 5 years ago

Closed 5 years ago

#6443 closed defect (fixed)

EmailDistributor does not work for tickects with non-Ascii names

Reported by: dbely Owned by: doki_pen
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 doki_pen 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by uvolodia@…

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

comment:2 Changed 5 years ago by anonymous

  • Cc uvolodia@… added; anonymous removed

comment:3 Changed 5 years ago by doki_pen

  • Owner changed from ixokai to doki_pen

comment:4 Changed 5 years ago by doki_pen

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r7683

comment:5 Changed 5 years ago by dbely

  • Resolution fixed deleted
  • Status changed from closed to reopened

Please also fix it in 0.11dev branch

comment:6 Changed 5 years ago by anonymous

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:7 Changed 5 years ago by dbely

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 5 years ago by doki_pen

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

Changed 5 years ago by doki_pen

comment:9 follow-up: Changed 5 years ago by doki_pen

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

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

Yes, it works OK. Please commit. Thanks!

comment:11 Changed 5 years ago by doki_pen

  • Resolution set to fixed
  • Status changed from reopened to closed

Done in r7874. Thanks for testing.

Add Comment

Modify Ticket

Action
as closed The owner will remain doki_pen.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.