Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

#8326 closed defect (fixed)

AttributeError: 'NoneType' object has no attribute 'split'

Reported by: jan Owned by: Remy Blank
Priority: normal Milestone: 0.12
Component: general Version: 0.11.4
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

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

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'e7d12758024a546eb53df937',
 'action': u'leave',
 'cnum': u'4',
 'comment': u'tracking participation - it is our objective to level the game based on the players experience and participation. we are working on fleshing this out - TBD',
 'field_businessvalue': u'',
 'field_cc': u'',
 'field_component': u'component1',
 'field_description': u'Tracking participation and earning rewards:\r\n\r\n\u201cKids will be encouraged to \u2018fill\u2019 their scrapbook by finding all the identified objects and add them to their pages, including objects they have built, created, \r\nor that simply appeal to them.\u201d\r\n\r\nCan you please explain where will these object be placed?\r\nPlease start marking on the flow/user experience map where these object will be placed so that the production teams would know to include them on the pages when building.\r\n\r\n\r\nPlease explain how this would work in more detail.\r\n',
 'field_drp_resources': u'',
 'field_i_links': u'',
 'field_keywords': u'',
 'field_milestone': u'',
 'field_o_links': u'',
 'field_priority': u'should have',
 'field_rd_points': u'',
 'field_remaining_time': u'',
 'field_reporter': u'Yulia',
 'field_sprint': u'',
 'field_story_priority': u'',
 'field_summary': u'Question 9: Tracking Participation and Earning Rewards',
 'field_type': u'defect',
 'field_version': u'',
 'id': u'52',
 'pane': u'edit',
 'preview': u'Preview',
 'replyto': u'',
 'ts': u'2009-05-26 22:25:28+00:00'}

User Agent was: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10

System Information

Trac 0.11.4
Python 2.4.4 (#1, Apr 15 2008, 23:37:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]
setuptools 0.6c9
SQLite 3.3.8
pysqlite 2.3.2
Genshi 0.5.1
Agilo 0.7.3.3-r1417-20090313
Subversion 1.4.2 (r22196)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/web/main.py", line 435, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/ticket/web_ui.py", line 182, in process_request
    return self._process_ticket_request(req)
  File "/usr/lib/python2.4/site-packages/agilo-0.7.3.3_r1417_20090313-py2.4.egg/agilo/ticket/web_ui.py", line 202, in _process_ticket_request
    template, data, content_type = super(AgiloTicketModule, self)._process_ticket_request(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/ticket/web_ui.py", line 531, in _process_ticket_request
    get_reporter_id(req, 'author'), field_changes)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/ticket/web_ui.py", line 1260, in _insert_ticket_data
    self._render_property_changes(req, ticket, field_changes)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.egg/trac/ticket/web_ui.py", line 1310, in _render_property_changes
    resource_new)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.4-py2.4.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'

Attachments (1)

8326-null-ticket-fields-r8656.patch (3.0 KB ) - added by Remy Blank 11 years ago.
Ensure ticket fields are always strings.

Download all attachments as: .zip

Change History (10)

comment:1 by Christian Boos, 11 years ago

Resolution: wontfix
Status: newclosed

PluginIssue (see AgiloForScrum).

Somehow the keywords field (either the old or the new value) got a None value, which shouldn't happen. If someone can find a way to reproduce this in Trac without the agilo plugin, then please describe the steps to reproduce and reopen.

comment:2 by Christian Boos, 11 years ago

Please don't spam this ticket. In case comment:1 was not clear enough:

This is not a problem in Trac, but in a plugin not maintained here, hence it's a wontfix resolution for us, and there's no point reopening the ticket. Thanks.

comment:3 by Christian Boos, 11 years ago

However, more recent versions of Trac (0.11.6) will be more robust if this method gets invalid input, see #8547.

comment:4 by Remy Blank, 11 years ago

These issues seem to have popped up more frequently since [7570], where undefined ticket fields have become None instead of the empty string, so that unset fields can get the current default value. I wonder if we could solve that issue by using an empty instance of a unicode subclass as a tag instead of None:

  • It would still be possible to differentiate between an empty field and a field that is not set in Ticket.get_value_or_default(), based on the string type.
  • We would be more robust against code which doesn't expect None in a ticket field, because the tag would appear as a normal unicode string.

by Remy Blank, 11 years ago

Ensure ticket fields are always strings.

comment:5 by Remy Blank, 11 years ago

Milestone: 0.12
Resolution: wontfix
Status: closedreopened

How about something like the patch above? Ticket fields whose value is NULL in the database are converted to a type-tagged empty string, so:

  • Ticket field values are always strings
  • We can still differentiate between unset fields and empty fields in Ticket.get_value_or_default()

This should make Trac more robust against the kind of issue reported here, both in plugins and in core. The patch also reverts [8451], which is not needed anymore.

comment:6 by Remy Blank, 11 years ago

Owner: set to Remy Blank
Status: reopenednew

comment:7 by Christian Boos, 11 years ago

I'm fine with the change.

However, I think we should still take care to put empty strings in the database, not NULLs and in general restrict the usage of the empty for cases where it's really necessary, like Ticket.get_value_or_default(). As empty is also the empty string, I think this will just work fine.

in reply to:  7 comment:8 by Remy Blank, 11 years ago

Replying to cboos:

However, I think we should still take care to put empty strings in the database, not NULLs

Absolutely. The idea was not to treat NULL and the empty string as identical: the former is a field that has never been set (e.g. because a new custom field has been added), the latter is just a field with an empty value. The fact that using a marked empty string will avoid some implementation issues is just a nice side-effect.

and in general restrict the usage of the empty for cases where it's really necessary, like Ticket.get_value_or_default().

Agreed. Thank you for the feedback!

comment:9 by Remy Blank, 11 years ago

Resolution: fixed
Status: newclosed

Patch applied in [8661].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank 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.