# Ticket #6336 (closed defect: fixed)

Opened 3 years ago

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

Reported by: Assigned to: ctmurphy pacopablo high TaskListPlugin major 0.12

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


## Change History

### 11/19/10 10:12:38 changed 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]


### 11/19/10 21:09:08 changed by rjollos

• description changed.

### 12/06/10 23:48:40 changed 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.

### 12/07/10 00:26:37 changed 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?

### 12/07/10 01:00:53 changed by rjollos

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

### 12/16/10 00:27:15 changed by rjollos

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

### 12/16/10 00:57:03 changed by rjollos

• status changed from new to closed.
• resolution set to fixed.

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

### 12/16/10 00:59:14 changed 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/Change #6336 (AttributeError: 'list' object has no attribute 'items')

Change Properties