Modify ↓
Opened 20 years ago
Closed 20 years ago
#846 closed defect (fixed)
Error on Custom Query with python 2.1
Reported by: | vittorio | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | high | Milestone: | 0.8 |
Component: | ticket system | Version: | devel |
Severity: | major | Keywords: | query |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
i get following Oops when clicking on "Custom Query" using python 2.1:
Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/trac/core.py", line 526, in cgi_start real_cgi_start() File "/usr/lib/python2.1/site-packages/trac/core.py", line 521, in real_cgi_start dispatch_request(path_info, args, req, env) File "/usr/lib/python2.1/site-packages/trac/core.py", line 436, in dispatch_request module.run() File "/usr/lib/python2.1/site-packages/trac/Module.py", line 44, in run self.render() File "/usr/lib/python2.1/site-packages/trac/Query.py", line 95, in render self._render_editor(constraints, order, desc) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 123, in _render_editor constraints, 'query.options.') File "/usr/lib/python2.1/site-packages/trac/Query.py", line 108, in add_options util.add_to_hdf(options, self.req.hdf, prefix + field) NameError: global name 'self' is not defined
trunk r990, python 2.1.3
Attachments (3)
Change History (12)
comment:1 by , 20 years ago
Component: | report system → ticket system |
---|---|
Keywords: | query added |
comment:2 by , 20 years ago
Status: | new → assigned |
---|
by , 20 years ago
Attachment: | query_python21.patch added |
---|
comment:3 by , 20 years ago
after applying query_python21.patch i get following error on custom query:
Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/trac/core.py", line 526, in cgi_start real_cgi_start() File "/usr/lib/python2.1/site-packages/trac/core.py", line 521, in real_cgi_start dispatch_request(path_info, args, req, env) File "/usr/lib/python2.1/site-packages/trac/core.py", line 436, in dispatch_request module.run() File "/usr/lib/python2.1/site-packages/trac/Module.py", line 44, in run self.render() File "/usr/lib/python2.1/site-packages/trac/Query.py", line 95, in render self._render_editor(constraints, order, desc) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 131, in _render_editor self.req.hdf, 'query.options.') File "/usr/lib/python2.1/site-packages/trac/Query.py", line 113, in add_db_options cursor.execute(sql) NameError: global name 'cursor' is not defined
by , 20 years ago
Attachment: | query_python21.2.patch added |
---|
New patch for python2.1 compat. Includes first patch.
comment:4 by , 20 years ago
following problem with query_python21.2.patch:
Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/trac/core.py", line 526, in cgi_start real_cgi_start() File "/usr/lib/python2.1/site-packages/trac/core.py", line 521, in real_cgi_start dispatch_request(path_info, args, req, env) File "/usr/lib/python2.1/site-packages/trac/core.py", line 436, in dispatch_request module.run() File "/usr/lib/python2.1/site-packages/trac/Module.py", line 44, in run self.render() File "/usr/lib/python2.1/site-packages/trac/Query.py", line 93, in render self._render_editor(constraints, order, desc) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 129, in _render_editor self.req.hdf, 'query.options.') File "/usr/lib/python2.1/site-packages/trac/Query.py", line 117, in add_db_options add_options(field, options, constraints, hdf, prefix) NameError: global name 'add_options' is not defined
comment:5 by , 20 years ago
when adding as advised at the begining of Query.py:
from __future__ import nested_scopes
the Custom Query works.
but i get following error when clicking on Refine Query in Roadmap view:
Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/trac/core.py", line 526, in cgi_start real_cgi_start() File "/usr/lib/python2.1/site-packages/trac/core.py", line 521, in real_cgi_start dispatch_request(path_info, args, req, env) File "/usr/lib/python2.1/site-packages/trac/core.py", line 436, in dispatch_request module.run() File "/usr/lib/python2.1/site-packages/trac/Module.py", line 44, in run self.render() File "/usr/lib/python2.1/site-packages/trac/Query.py", line 94, in render self._render_editor(constraints, order, desc) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 133, in _render_editor self.req.hdf, 'query.options.') File "/usr/lib/python2.1/site-packages/trac/Query.py", line 118, in add_db_options add_options(field, options, constraints, hdf, prefix) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 105, in add_options if check and (option['name'] in constraints[field]):
comment:6 by , 20 years ago
full traceback:
Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/trac/core.py", line 526, in cgi_start real_cgi_start() File "/usr/lib/python2.1/site-packages/trac/core.py", line 521, in real_cgi_start dispatch_request(path_info, args, req, env) File "/usr/lib/python2.1/site-packages/trac/core.py", line 436, in dispatch_request module.run() File "/usr/lib/python2.1/site-packages/trac/Module.py", line 44, in run self.render() File "/usr/lib/python2.1/site-packages/trac/Query.py", line 94, in render self._render_editor(constraints, order, desc) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 133, in _render_editor self.req.hdf, 'query.options.') File "/usr/lib/python2.1/site-packages/trac/Query.py", line 118, in add_db_options add_options(field, options, constraints, hdf, prefix) File "/usr/lib/python2.1/site-packages/trac/Query.py", line 105, in add_options if check and (option['name'] in constraints[field]): TypeError: 'in ' requires character as left operand
Note:
See TracTickets
for help on using tickets.
Patch for Python2.1 compat. Please try and report back.