Opened 12 years ago
Closed 10 years ago
#10907 closed defect (fixed)
TypeError: unhashable type: 'list' with malformed URL
Reported by: | Owned by: | Jun Omae | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | query system | Version: | 0.12-stable |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fix crashing query page with multiple |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
How to Reproduce
While doing a GET operation on /query
, Trac issued an internal error.
If the order= is specified twice, such as http://trac.edgewall.org/query?order=priority&order=owner trac will error. Issue is user may not be able to edit the custom query again. Probably the line specified needs to check whether "order" is a list, and do something sane like grab the first item.
Request parameters:
{'order': [u'priority', u'owner']}
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
System Information
System information not available
Enabled Plugins
Plugin information not available
Python Traceback
Traceback (most recent call last): File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11388-py2.6.egg/trac/web/main.py", line 497, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11388-py2.6.egg/trac/web/main.py", line 214, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11388-py2.6.egg/trac/ticket/query.py", line 938, in process_request max) File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.1dev_r11388-py2.6.egg/trac/ticket/query.py", line 78, in __init__ self.order = synonyms.get(order, order) # 0.11 compatibility TypeError: unhashable type: 'list'
Attachments (0)
Change History (9)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 12 years ago
Component: | general → query system |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
comment:3 by , 12 years ago
comment:4 by , 10 years ago
Milestone: | → 0.12.7 |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Version: | 1.0dev → 0.12-stable |
I don't think this issue is a duplicate. It reproduces by query:?
link with multiple orders like this.
query:?order=priority&order=id
If query:
link doesn't have ?
character, the issue doesn't occur.
query:order=priority&order=id
2014-09-30 16:21:23,133 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/home/jun66j5/src/tracdev/git/trac/web/main.py", line 529, in _dispatch_request dispatcher.dispatch(req) File "/home/jun66j5/src/tracdev/git/trac/web/main.py", line 243, in dispatch resp = chosen_handler.process_request(req) File "/home/jun66j5/src/tracdev/git/trac/ticket/query.py", line 939, in process_request max) File "/home/jun66j5/src/tracdev/git/trac/ticket/query.py", line 74, in __init__ self.order = synonyms.get(order, order) # 0.11 compatibility TypeError: unhashable type: 'list'
comment:5 by , 10 years ago
Milestone: | 0.12.7 → 1.0.3 |
---|---|
Owner: | set to |
Status: | reopened → assigned |
Duplicated report
parameters, e.g. query:?report=1&report=2
, leads a similar issue.
Traceback (most recent call last): File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/web/main.py", line 529, in _dispatch_request dispatcher.dispatch(req) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/web/main.py", line 243, in dispatch resp = chosen_handler.process_request(req) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/ticket/query.py", line 960, in process_request return self.display_html(req, query) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/ticket/query.py", line 1100, in display_html "WHERE id=%s", (query.id,)) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/db/util.py", line 61, in execute r = self.cursor.execute(sql_escape_percent(sql), args) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 80, in execute result = PyFormatCursor.execute(self, *args) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 58, in execute args or []) File "/venv/trac/0.12.6/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 50, in _rollback_on_error return function(self, *args, **kwargs) InterfaceError: Error binding parameter 0 - probably unsupported type.
follow-up: 8 comment:7 by , 10 years ago
Looks good. Just curious, is there a case in which order
can be a tuple
, or are you just protecting against future change?
Is this test addition useful?:
-
trac/ticket/tests/query.py
diff --git a/trac/ticket/tests/query.py b/trac/ticket/tests/query.py index 3c0807c..5003203 100644
a b class QueryLinksTestCase(unittest.TestCase): 659 659 # query:?order=priority&order=id 660 660 data = self._query_with_duplicated_args('order', ['priority', 'id']) 661 661 self.assertEqual([], data['tickets']) 662 self.assertEqual('priority', data['query'].order) 662 663 663 664 def test_duplicated_report_arguments(self): 664 665 # query:?report=1&report=2
comment:8 by , 10 years ago
Looks good. Just curious, is there a case in which
order
can be atuple
, or are you just protecting against future change?
Thanks for the reviewing. Well, no particular reason. But I think isinstance(obj, (list, tuple))
is an idiom in Python to detect array object.
Is this test addition useful?: […]
Yeah, that's useful. I'll commit the changes with your suggestion.
comment:9 by , 10 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Duplicate of #10838 (which got unnoticed so far, so thanks for reporting ;-) ).