#11369 closed defect (fixed)
Tags in error message from ticket notification is wrongly shown
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.6 |
| Component: | ticket system | Version: | 1.0-stable |
| Severity: | normal | Keywords: | notification |
| Cc: | Branch: | ||
| Release Notes: |
Fix wrongly showing warning messages from notification if both |
||
| API Changes: |
Added |
||
| Internal Changes: | |||
Description (last modified by )
When [notification] smtp_from or smtp_reply_to have the problem, ticket notification would show an error message which has Genshi elements. But the tags is wrongly shown…. Trac 0.12-stable has the same issue.
Attachments (2)
Change History (12)
comment:1 by , 12 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 12 years ago
| Milestone: | next-stable-1.0.x → 0.12.6 |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
#11368 is cosmetic so I thought I'd push the change to 1.0-stable, but this one looks like it should be fixed on 0.12-stable, as you may have already been suggesting.
comment:3 by , 12 years ago
There are at least two issues:
- The exception message is wrapped in a pair of sibling
ptags. I think we can probably remove these, particularly if the error will always be handled and displayed as a warning, which is the only case that I see. - The
Fragmentis serialized to a unicode string when doing string interpolation to construct another fragment: tags/trac-0.12.5/trac/ticket/web_ui.py@:1250-1253#L1221. This is why we end up with markup such as:
For the latter issue, I think we need to iterate over the Fragment, replacing the ascii strings with unicode strings: log:rjollos.git:t11369. I still plan to do some more testing since I'm not confident of the change yet.
Another issue, also related to #11368, is that it would be nice to strip out the markup when logging the error. That would make these errors more readable:
12:45:47 PM Trac[main] WARNING: HTTPInternalError: 500 Trac Error (Authentication information not available. Please refer to the <a href="/tracdev/wiki/TracInstall#ConfiguringAuthentication" title="Configuring Authentication">installation documentation</a>.)
12:38:55 PM Trac[web_ui] ERROR: Failure sending notification on change to ticket #5: TracError: Unable to send email due to identity crisis. Neither <b>notification.from</b> nor <b>notification.reply_to</b> are specified in the configuration.
follow-up: 5 comment:4 by , 12 years ago
I've thought about this more and it seems better to have to_unicode to always return a string, and instead add a new function, e.g. unicode_fragment.
comment:5 by , 12 years ago
Replying to rjollos:
I've thought about this more and it seems better to have
to_unicodeto always return a string, and instead add a new function, e.g.unicode_fragment.
I made that change in [31e1f910/rjollos.git], but still considering alternatives.
by , 12 years ago
| Attachment: | 20131123T224600.png added |
|---|
follow-up: 7 comment:6 by , 12 years ago
- If Babel is intalled, the warnings are broken.
- In 0.12-stable, I don't think we must change translation messages.
- I don't understand need of
unicode_text_nodes. Why does not the method create new Fragment at all?
I've worked in log:jomae.git:t11369.1. But it breaks the warnings if Babel is installed, also.
by , 12 years ago
| Attachment: | 20131125T155058.png added |
|---|
comment:7 by , 12 years ago
I updated log:jomae.git:t11369.1.
This problem is caused by genshi.builder be not supporting Babel's LazyProxy object.
>>> from genshi.builder import tag >>> from trac.util.translation import tag_ >>> tag_("Neither %(from_)s", from_=tag.b('from')) <babel.support.LazyProxy object at 0xb7f458ec> >>> unicode( tag.p(tag_("Neither %(from_)s", from_=tag.b('from'))) ) u'<p>TEXTNeither -1-1STARTb-1-1TEXTfrom-1-1ENDb-1-1TEXT-1-1</p>'
I've added to_fragment function in log:jomae.git:t11369.1 to solve it.
>>> from trac.util.html import to_fragment >>> to_fragment( tag_("Neither %(from_)s", from_=tag.b('from')) ) <Fragment> >>> unicode(to_fragment( tag_("Neither %(from_)s", from_=tag.b('from')) )) u'Neither <b>from</b>' >>> unicode( tag.p(to_fragment(tag_("Neither %(from_)s", from_=tag.b('from')))) ) u'<p>Neither <b>from</b></p>'
But another issue is showing English message even if locale isn't en_US. It is caused by temporarily disabling localization while sending ticket notification, see #8903 and r8969.
comment:8 by , 12 years ago
| Owner: | changed from to |
|---|
comment:9 by , 12 years ago
| API Changes: | modified (diff) |
|---|---|
| Release Notes: | modified (diff) |
| Resolution: | → fixed |
| Status: | assigned → closed |
Applied log:jomae.git:t11369.1 and replaced notification.from and notification.reply_to in warnings with [notification] smtp_from and [notification] smtp_replyto in [12321]. Also, merged into 1.0-stable in [12322-12323] and trunk in [12324].
comment:10 by , 11 years ago
| Keywords: | notification added |
|---|



See http://twitpic.com/dlmyqd/full