Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

#11590 closed defect (fixed)

GET: /report internal error unsupported operand type(s) +: 'NoneType' and 'str'

Reported by: ciprian.parfon@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: report system Version: 1.0.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix crash while rendering report's description on report list page.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Hello

When I try to 'View Tickets' I get:

Oops…
Trac detected an internal error:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

There was an internal error in Trac. It is recommended that you notify your local
Trac administrator with the information needed to reproduce the issue.

To that end, you could a ticket.

The action that triggered the error was:

GET: /report

Here's the details of my setup:

Most recent call last:
File "/usr/lib64/python2.7/site-packages/trac/ticket/templates/report_list.html", line 99, in
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1546, in format_to_html
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1501, in generate
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1283, in format
File "/usr/lib64/python2.7/re.py", line 151, in sub
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1201, in replace
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1197, in handle_match
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 591, in _lhref_formatter
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 621, in _make_lhref_link
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 656, in _make_link
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 661, in _make_intertrac_link
File "/usr/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 667, in get_intertrac_url

Trac 1.0.1
Docutils 0.10
Genshi 0.7 (with speedups)
mod_wsgi 3.4 (WSGIProcessGroup svn WSGIApplicationGroup %{GLOBAL})
Pygments 1.6
pysqlite 2.6.0
Python 2.7.5 (default, Nov 26 2013, 18:44:35) [GCC 4.6.3]
pytz 2013d
setuptools 0.8
SQLite 3.8.2
Subversion 1.7.14 (r1542130)
jQuery 1.4.2

Enabled Plugins:

TracAccountManager 0.4.2 /usr/lib64/python2.7/site-packages

Attachments (0)

Change History (6)

comment:1 by Jun Omae, 11 years ago

Component: generalreport system
Description: modified (diff)

comment:2 by Jun Omae, 11 years ago

Milestone: undecidednext-stable-1.0.x

Good catch! Reproduced by the following steps.

  1. Create a report with [./@1#TheId] as description.
  2. View report list page.

The issue is similar to #11302.

...
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/ticket/templates/report_list.html", line 99, in <Expression u'wiki_to_html(context, description)'>
    ${wiki_to_html(context, description)}
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1546, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1501, in generate
    escape_newlines)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1283, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/venv/trac/1.0.1/lib/python2.5/re.py", line 150, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1201, in replace
    replacement = self.handle_match(fullmatch)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1197, in handle_match
    return internal_handler(match, fullmatch)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 591, in _lhref_formatter
    return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 621, in _make_lhref_link
    label, fullmatch)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 656, in _make_link
    return self._make_intertrac_link(ns, target, label) or \
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 661, in _make_intertrac_link
    res = self.get_intertrac_url(ns, target)
  File "/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 667, in get_intertrac_url
    url = intertrac.get(ns + '.url')
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

comment:3 by Jun Omae, 11 years ago

Milestone: next-stable-1.0.x1.0.2
Owner: set to Jun Omae
Status: newassigned

Proposed patch in the following. I'll add functional tests for the issue.

  • trac/ticket/templates/report_list.html

    diff --git a/trac/ticket/templates/report_list.html b/trac/ticket/templates/report_list.html
    index c8db59e..1ad590b 100644
    a b  
    9696              </a></h3>
    9797            <span class="foldable" />
    9898            <div py:if="description" class="description" xml:space="preserve">
    99               ${wiki_to_html(context, description)}
     99              ${wiki_to_html(context.child('report', id), description)}
    100100            </div>
    101101          </div>
    102102        </py:when>

comment:4 by Jun Omae, 11 years ago

Proposed changes in jomae.git@t11590 with functional tests.

comment:5 by Ryan J Ollos, 11 years ago

Tested and looks good to me.

comment:6 by Jun Omae, 11 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for testing. Committed in [12697] and merged in [12698].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.