Edgewall Software

Opened 15 years ago

Last modified 3 years ago

#8547 closed defect

AttributeError: 'NoneType' object has no attribute 'split' — at Version 1

Reported by: aahz@… Owned by: Christian Boos
Priority: normal Milestone: 0.11.6
Component: ticket system Version: none
Severity: normal Keywords: NULL
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

How to Reproduce

While doing a POST operation on /ticket/411, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'ebf9ea65f8fe75c21dc66626',
 'action': u'reopen',
 'action_change_owner_reassign_owner': u'anonymous',
 'author': u'aahz@pythoncraft.com',
 'cnum': u'7',
 'comment': u"As a new Trac user, I also find this behavior suboptimal.  It's been five years, please revisit this design flaw -- it makes it very difficult to update a ticket summary so that others don't need to scroll through the entire comment history.",
 'field_component': u'ticket system',
 'field_keywords': u'',
 'field_milestone': u'0.8',
 'field_priority': u'high',
 'field_severity': u'normal',
 'field_summary': u'Edit ticket description?',
 'field_type': u'defect',
 'field_version': u'0.7',
 'id': u'411',
 'preview': u'Preview',
 'replyto': u'',
 'ts': u'2006-06-21 08:26:44+00:00'}

System Information

Trac 0.11.5stable-r8354
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2]
setuptools 0.6c9
psycopg2 2.0.8
Genshi 0.6dev-r999
Pygments 1.0
Subversion 1.5.1 (r32289)

Python Traceback

Traceback (most recent call last):
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/web/main.py", line 444, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/ticket/web_ui.py", line 182, in process_request
    return self._process_ticket_request(req)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/ticket/web_ui.py", line 531, in _process_ticket_request
    get_reporter_id(req, 'author'), field_changes)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/ticket/web_ui.py", line 1260, in _insert_ticket_data
    self._render_property_changes(req, ticket, field_changes)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/ticket/web_ui.py", line 1310, in _render_property_changes
    resource_new)
  File "/usr/local/virtualenv/lib/python2.5/site-packages/Trac-0.11.5stable_r8354-py2.5.egg/trac/ticket/web_ui.py", line 1344, in _render_property_diff
    old_list, new_list = old.split(), new.split()
AttributeError: 'NoneType' object has no attribute 'split'

(see source:tags/trac-0.11.5/trac/ticket/web_ui.py@#L1344)

Change History (1)

comment:1 by Christian Boos, 15 years ago

Component: generalticket system
Description: modified (diff)
Milestone: 0.11.6
Owner: set to Christian Boos

Thanks for the report.

The keywords field for this ticket must have been NULL in the database, for some reason.

In this case we don't insert this field in the ticket values dict (L103-104), which implies that when setting the field later on, the _old dict ends with a None value (L123-124) in trac/ticket/model.py.

This was done in r7570 in order to fix #4061, so we can't fix the current issue by inserting '' in values in this case.

I guess we simply need to accept that _old['keywords'] can eventually be None.

  • trac/ticket/web_ui.py

     
    13411341                    'EMAIL_VIEW' in req.perm(resource_new or ticket.resource)):
    13421342                render_elt = obfuscate_email_address
    13431343        elif field == 'keywords':
    1344             old_list, new_list = old.split(), new.split()
     1344            old_list, new_list = (old or '').split(), new.split()
    13451345            sep = ' '
    13461346        if (old_list, new_list) != (None, None):
    13471347            added = [tag.em(render_elt(x)) for x in new_list

(new can't possibly be None here, but again, I thought the same about old at first inspection ;-) )

Note: See TracTickets for help on using tickets.