Modify

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#6336 closed defect (fixed)

AttributeError: 'list' object has no attribute 'items'

Reported by: ctmurphy Owned by: pacopablo
Priority: high Component: TaskListPlugin
Severity: major Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

This could very well be of my own fault - but I may need a little help figuring it out.

Since upgrading Trac to 0.12, I haven't been able to use TaskList and I miss it. This error is displayed when trying to access /tasklist

File "/usr/local/lib/python2.5/site-packages/Trac-0.12dev_r8641-py2.5.egg/trac/web/main.py", line 467, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/Trac-0.12dev_r8641-py2.5.egg/trac/web/main.py", line 212, in dispatch
  resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/tasklist/main.py", line 99, in process_request
User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Trac: 	0.12dev-r8641
Python: 	2.5.1 (r251:54863, Jan 11 2008, 10:58:38) [GCC 3.4.3 20041212 (Red Hat 3.4.3-10)]
setuptools: 	0.6c7
MySQL: 	server: "5.0.45-community", client: "5.0.45", thread-safe: 0
MySQLdb: 	1.2.2
Genshi: 	0.6dev-r1052
Babel: 	-
mod_python: 	3.3.1
Pygments: 	0.9
Subversion: 	1.4.6 (r28521)
jQuery:	1.3.2

Attachments (0)

Change History (10)

comment:1 Changed 5 years ago by cboos

See also googlegroups:trac-users:7488291261db4071 for some explanations about the error.

comment:2 Changed 4 years ago by anonymous

In main.py change lines 99-102 from

            for field, vals in constraints.items():
                for val in vals:
                    if val.endswith('$USER'):
                        del constraints[field]

to

            for field, vals in constraints[0].items():
                for val in vals:
                    if val.endswith('$USER'):
                        del constraints[0][field]

comment:3 Changed 4 years ago by rjollos

  • Description modified (diff)

comment:4 Changed 4 years ago by rjollos

I'm dealing with what looks like the same issue for the TracHoursPlugin in #7996. I have a fix just like that shown in comment:2, however I wonder if we should also be iterating over constraints, since it can be a list.

comment:5 Changed 4 years ago by rjollos

It looks like we might be able to get away with replacing constraints with constraints[0] as long as there are no OR clauses in the query. Can anyone confirm that this is a safe assumption?

comment:6 Changed 4 years ago by rjollos

I also wonder why the change to the Query class is not discussed in t:TracDev/ApiChanges/0.12.

comment:7 Changed 4 years ago by anonymous

bump... any updates?

comment:8 Changed 4 years ago by rjollos

(In [9682]) Creating a branch for Trac 0.11. Refs #6336.

comment:9 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

(In [9683]) Handle constraints as a list of dictionaries in Trac 0.12. Fixes #6336.

comment:10 Changed 4 years ago by rjollos

I put in place what I think is a safe fix, by iterating over constraints. This may not be necessary, and I made a note about this in the source code.

There is now a branch for 0.11 and the trunk is compatible with 0.12.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.