Modify

Opened 11 years ago

Last modified 10 years ago

#11264 assigned defect

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

Reported by: Ivanelson Nunes Owned by: Chris Nelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

2013-08-07 19:20:07,902 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/web_ui.py", line 179, in process_request
    return self._process_ticket_request(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/web_ui.py", line 614, in _process_ticket_request
    self._do_save(req, ticket, action)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/web_ui.py", line 1328, in _do_save
    replyto=req.args.get('replyto'))
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/model.py", line 363, in save_changes
    listener.ticket_changed(self, comment, author, old_values)
  File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-0.10-py2.7.egg/tracjsgantt/tracpm.py", line 2951, in ticket_changed
    self.rescheduleTickets(ticket, old_values)
  File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-0.10-py2.7.egg/tracjsgantt/tracpm.py", line 2739, in rescheduleTickets
    ids = self._findAffected(ticket, old_values)
  File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-0.10-py2.7.egg/tracjsgantt/tracpm.py", line 2427, in _findAffected
    affected |= affectedByOld(old_values)
  File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-0.10-py2.7.egg/tracjsgantt/tracpm.py", line 2360, in affectedByOld
    and len(old_values['parents']) != 0:
TypeError: object of type 'NoneType' has no len()

Attachments (0)

Change History (9)

comment:1 Changed 11 years ago by Chris Nelson

In 13360:

Don't test old values for len if they are null. Refs #11264.

comment:2 Changed 11 years ago by Chris Nelson

Status: newassigned

I don't see this problem on my system but this change should logically take care of it.

comment:3 Changed 11 years ago by Ivanelson Nunes

This problem only occurs when the ticket is recorded via the plugin email2trac.

My plugin configuration email2trac:

DEFAULT_keywords: ServiceDesk DEFAULT_component: TRAC DEFAULT_priority: High DEFAULT_severity: Normal DEFAULT_type: Screening DEFAULT_parents: 0

This field above the email2trac assigns default values​​.

I will test your last change.

Thank

comment:4 in reply to:  1 Changed 11 years ago by Ivanelson Nunes

Replying to ChrisNelson:

In 13360:

Don't test old values for len if they are null. Refs #11264.

I downloaded the newest version. But the problem remains. The error only happens when the ticket is recorded by Email2Trac Plugin.

comment:5 Changed 11 years ago by Ivanelson Nunes

Bizarre! The error seems its caused by some inconsistent information in my database. No trace information shows tickets the past.

Name    Value
f   : 'blocking'
fwd : 'pred'
fwd     : Field None
linkField: 'pred'
linkFieldNames: {'pred': None, 'succ': None, 'parent': None}
old_values: {'status': u'new', 'aplicacao': None, 'projeto': None, 'component': ...
previewFields:  {'pred': 'blockedby', 'succ': 'blocking'}
relationshipChanged:    True
rev:        'succ'
revField:   None
self:   <tracjsgantt.tracpm.TicketRescheduler object at 0x7fb9c8073190>
t   : {'status': u'active', 'description': u'Milestone PDV NFS', 'parent': [], ...
ticket  : <trac.ticket.model.Ticket object at 0x7fb9c84c8910>
tickets : [{u'status': u'new', u'changetime': datetime.datetime(2013, 5, 24, 22, 43, ...
ticketsByID:    {3296: {u'status': u'new', u'changetime': datetime.datetime(2013, 5, 24, ...

comment:6 in reply to:  5 Changed 11 years ago by Ivanelson Nunes

Replying to ivanelson:

Bizarre! The error seems its caused by some inconsistent information in my database. No trace information shows tickets the past.

Name    Value
f   : 'blocking'
fwd : 'pred'
fwd     : Field None
linkField: 'pred'
linkFieldNames: {'pred': None, 'succ': None, 'parent': None}
old_values: {'status': u'new', 'aplicacao': None, 'projeto': None, 'component': ...
previewFields:  {'pred': 'blockedby', 'succ': 'blocking'}
relationshipChanged:    True
rev:        'succ'
revField:   None
self:   <tracjsgantt.tracpm.TicketRescheduler object at 0x7fb9c8073190>
t   : {'status': u'active', 'description': u'Milestone PDV NFS', 'parent': [], ...
ticket  : <trac.ticket.model.Ticket object at 0x7fb9c84c8910>
tickets : [{u'status': u'new', u'changetime': datetime.datetime(2013, 5, 24, 22, 43, ...
ticketsByID:    {3296: {u'status': u'new', u'changetime': datetime.datetime(2013, 5, 24, ...

Could this be the problem?

select * from ticket_change where tc.ticket = '3296 ';

output:

3296; 1369435434405392 "; ivanelson", "parents", "2466", "2468"

Ticket before 3296 was the son of the ticket in 2466, is now a child of 2468 Ticket 2468 and is the son of the ticket in 2466.

Last edited 11 years ago by Ivanelson Nunes (previous) (diff)

comment:7 Changed 11 years ago by Ivanelson Nunes

Do not test for old values ​​if len They are null.

In method "splicegraph":

On line in 2663. I changed it. of:

if len(old_values[previewFields[fwd]]) == 0:
    oldDependants = set()
else:
    ...

for:

if (old_values[previewFields[fwd]]) and
    len(old_values[previewFields[fwd]]) == 0:
    oldDependants = set()
else:
    ...

I think to solve the problem. I'm testing.

comment:8 in reply to:  7 Changed 10 years ago by Chris Nelson

Replying to ivanelson:

... I think to solve the problem. I'm testing.

Did it work?

comment:9 Changed 10 years ago by Ivanelson Nunes

Not solved! The problem was the plugin email2trac. Here is the solution:

https://oss.trac.surfsara.nl/email2trac/ticket/338

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Chris Nelson.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.