Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

#12107 closed defect (fixed)

TypeError: object of type 'NoneType' has no len()

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.7
Component: ticket system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed traceback when navigating to /newticket?preview=1.

API Changes:
Internal Changes:

Description

Navigating directly to /newticket?preview=1 results in the following error:

2015-06-15 22:05:07,962 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.6post2-py2.6.egg/trac/web/main.py", line 534, in _dispatch_request
    dispatcher.dispatch(req)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.6post2-py2.6.egg/trac/web/main.py", line 227, in dispatch
    resp = chosen_handler.process_request(req)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.6post2-py2.6.egg/trac/ticket/web_ui.py", line 183, in process_request
    return self._process_newticket_request(req)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.6post2-py2.6.egg/trac/ticket/web_ui.py", line 466, in _process_newticket_request
    valid = self._validate_ticket(req, ticket)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.6post2-py2.6.egg/trac/ticket/web_ui.py", line 1282, in _validate_ticket
    if len(ticket['summary']) > self.max_summary_size:
TypeError: object of type 'NoneType' has no len()

This is not of much concern, it's just an error I found in the logs. The fix appears to be simple though:

  • trac/ticket/web_ui.py

    diff --git a/trac/ticket/web_ui.py b/trac/ticket/web_ui.py
    index 15680d6..ada9023 100644
    a b class TicketModule(Component):  
    12791279            valid = False
    12801280
    12811281        # Validate summary length
    1282         if len(ticket['summary']) > self.max_summary_size:
     1282        if len(ticket['summary'] or '') > self.max_summary_size:
    12831283            add_warning(req, _("Ticket summary is too long (must be less "
    12841284                               "than %(num)s characters)",
    12851285                               num=self.max_summary_size))

Attachments (0)

Change History (1)

comment:1 by Ryan J Ollos, 5 years ago

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

Committed to 1.0-stable in [14112], merged to trunk in [14113].

Modify Ticket

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