Edgewall Software

Opened 9 years ago

Last modified 9 years ago

#12107 closed defect

TypeError: object of type 'NoneType' has no len() — at Initial Version

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:
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))

Change History (0)

Note: See TracTickets for help on using tickets.