Opened 16 years ago
Closed 16 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)
Change History (12)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
| Cc: | uvolodia@… added; anonymous removed |
|---|
comment:3 Changed 16 years ago by
| Owner: | changed from Stephen Hansen to Robert Corsaro |
|---|
comment:5 Changed 16 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Please also fix it in 0.11dev branch
comment:6 Changed 16 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
comment:7 Changed 16 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → 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?)
Changed 16 years ago by
| Attachment: | unicode_subject-0.patch added |
|---|
comment:9 follow-up: 10 Changed 16 years ago by
Can you give the attached patch a whirl and if it works I'll commit it?
comment:11 Changed 16 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Done in r7874. Thanks for testing.



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