Edgewall Software

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11033 closed defect (fixed)

sub_vars() chokes on None values — at Version 4

Reported by: anonymous Owned by: Remy Blank
Priority: normal Milestone: 1.1.1
Component: general Version: 1.1.1dev
Severity: normal Keywords:
Cc: ryan.j.ollos@… Branch:
Release Notes:

Handle case of report description being None for report variable substitution implemented in #10979.

API Changes:
Internal Changes:

Description

How to Reproduce

While doing a GET operation on /report/1, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'id': u'1'}

User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4

System Information

System information not available

Enabled Plugins

Plugin information not available

Python Traceback

Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11538-py2.6.egg/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11538-py2.6.egg/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11538-py2.6.egg/trac/ticket/report.py", line 181, in process_request
    template, data, content_type = self._render_view(req, id)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11538-py2.6.egg/trac/ticket/report.py", line 427, in _render_view
    'description': sub_vars(description, args),
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11538-py2.6.egg/trac/util/text.py", line 722, in sub_vars
    return sub_vars_re.sub(repl, text)
TypeError: expected string or buffer

Change History (4)

comment:1 by Remy Blank, 11 years ago

Owner: set to Remy Blank
Status: newassigned
Summary: Test testsub_vars() chokes on None values

Is this an actual issue? It looks so, but the title is misleading.

Anyway, my best guess with the limited information available is that the description field is NULL. We should probably catch this case in sub_vars() to be more robust.

comment:2 by Remy Blank, 11 years ago

Milestone: 1.1.1
Version: 1.1.1dev

comment:3 by Remy Blank, 11 years ago

Resolution: fixed
Status: assignedclosed

Ah, no, let's keep sub_vars() as requiring a string argument. The title is already guaranteed to be a string, so only the description could be NULL. Fixed in [11642].

comment:4 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Cc: ryan.j.ollos@… added
Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.