Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#7250 closed defect (fixed)

[Patch] Wiki to HTML rendering of Description, and more robustness for Description and Comment rendering

Reported by: pipern Owned by: doki_pen
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 0.12

Description

If the change comment for a ticket include hyperlinks, then it failed with this exception:

...
  File "...trac/wiki/formatter.py", line 1147, in handle_match
    return internal_handler(match, fullmatch)
  File "...trac/wiki/formatter.py", line 529, in _shref_formatter
    return self._make_link(ns, target, match, match, fullmatch)
  File "...trac/wiki/formatter.py", line 590, in _make_link
    return self._make_ext_link(ns+':'+target, label)
  File "...trac/wiki/formatter.py", line 653, in _make_ext_link
    (self.req or self.env).abs_href.base
AttributeError: 'str' object has no attribute 'base'

because we were passing in a string for abs_href to Mock req. I've changed that to pass in the real env.abs_href, and also started to render the Description as HTML too.

Patch attached.

Attachments (1)

th-7250.diff (3.1 KB) - added by pipern 4 years ago.
Patch to render description and use env.abs_href in the Mock req rather than string returned by env.abs_ref()

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by pipern

Patch to render description and use env.abs_href in the Mock req rather than string returned by env.abs_ref()

comment:1 Changed 4 years ago by olistudent

I have to errors with announcer plugin at the moment.

2010-06-19 12:12:34,481 Trac[ticket_email] ERROR:.
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/announcerplugin/formatters/ticket_email.py", line 189, in _format_html
    temp = formatter.generate(True)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7.1dev_r0-py2.6.egg/trac/wiki/formatter.py", line 1082, in generate
    escape_newlines)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7.1dev_r0-py2.6.egg/trac/wiki/formatter.py", line 857, in format
    for line in text.splitlines():
AttributeError: 'NoneType' object has no attribute 'splitlines'
2010-06-19 12:12:34,729 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 233, in distribute
    self._do_send(transport, event, k, v, fmtdict[k])
  File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 328, in _do_send
    rootMessage['X-Trac-Announcement-ID'] = self._event_id(event)
  File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 298, in _event_id
    self.log.warning("%08d"%event.target.id)
TypeError: %d format: a number is required, not unicode
2010-06-19 12:13:08,389 Trac[email_distributor] WARNING: 00000864
2010-06-19 12:13:08,389 Trac[email_distributor] WARNING: 00000864

The first seems to have gone with your patch. Thank you!
It occurs when adding an attachment to a ticket without writing a description.
The second error persits. Perhaps I will open a new ticket for it.

comment:2 Changed 4 years ago by rjollos

  • Summary changed from Wiki to HTML rendering of Description, and more robustness for Description and Comment rendering [PATCH] to [Patch] Wiki to HTML rendering of Description, and more robustness for Description and Comment rendering

comment:3 Changed 4 years ago by doki_pen

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

(In [8911]) Adds description wiki processing and robustness

Fixes #7250
Thanks pipern!

comment:4 Changed 4 years ago by doki_pen

Tested attachment with no description and it works fine in trunk.

Add Comment

Modify Ticket

Action
as closed .
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.