Modify ↓
#7036 closed defect (fixed)
QuerySyntaxError: Query filter requires field and constraints separated by a "="
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | high | Milestone: | 0.11.2 |
Component: | report system | Version: | 0.11b2 |
Severity: | critical | Keywords: | query |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Hi,
When I want to view tickets using a custom query, I get the error below. This happens with a project migrated from 0.10.4 to 0.11-b2 (copied to 0.11-b2 Trac instance and then upgraded with trac-admin) where the same operation works perfectly.
Defining a default query in trac.ini doesn't help.
Michel
QuerySyntaxError: Query filter requires field and constraints separated by a "=" If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team. Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket. Otherwise, please ==== How to Reproduce ==== While doing a GET operation on `/query`, Trac issued an internal error. ''(please provide additional details here)'' User Agent was: `Mozilla/5.0 (Windows; U; Windows NT 5.2; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1` ==== System Information ==== || '''Trac''' || `0.11b2` || || '''Python''' || `2.4.1 (#4, Sep 15 2005, 16:38:29) [C]` || || '''setuptools''' || `0.6c8` || || '''SQLite''' || `3.3.7` || || '''pysqlite''' || `2.3.2` || || '''Genshi''' || `0.5dev-r809` || || '''Subversion''' || `1.4.6 (r28521)` || || '''jQuery:''' || `1.2.3` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 419, in _dispatch_request dispatcher.dispatch(req) File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 196, in dispatch resp = chosen_handler.process_request(req) File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 615, in process_request constraints = Query.from_string(self.env, qstring).constraints File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 97, in from_string raise QuerySyntaxError('Query filter requires field and ' QuerySyntaxError: Query filter requires field and constraints separated by a "=" }}} a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it. Python Traceback Most recent call last: * File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 419, in _dispatch_request Code fragment: 414. try: 415. if not env and env_error: 416. raise HTTPInternalError(env_error) 417. try: 418. dispatcher = RequestDispatcher(env) 419. dispatcher.dispatch(req) 420. except RequestDone: 421. pass 422. resp = req._response or [] 423. 424. except HTTPException, e: Local variables: Name Value after [' except RequestDone:', ' pass', ' resp = ... before [' try:', ' if not env and env_error:', ' raise ... dispatcher <trac.web.main.RequestDispatcher object at 0x14174bc10> e <trac.ticket.query.QuerySyntaxError instance at 0x141821a70> env <trac.env.Environment object at 0x1414a3890> env_error None exc_info (<class trac.ticket.query.QuerySyntaxError at 0x140abe230>, ... filename '/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.1 ... frames [{'function': '_dispatch_request', 'lines_before': [' try:', ' ... has_admin True line ' dispatcher.dispatch(req)' lineno 418 message u'QuerySyntaxError: Query filter requires field and constraints separated ... req <Request "GET u'/query'"> resp [] tb <traceback object at 0x14174c878> tb_hide None traceback 'Traceback (most recent call last):\n File ... * File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 196, in dispatch Code fragment: 191. req.args.get('__FORM_TOKEN') != req.form_token: 192. raise HTTPBadRequest('Missing or invalid form token. ' 193. 'Do you have cookies enabled?') 194. 195. # Process the request and render the template 196. resp = chosen_handler.process_request(req) 197. if resp: 198. if len(resp) == 2: # Clearsilver 199. chrome.populate_hdf(req) 200. template, content_type = \ 201. self._post_process_request(req, *resp) Local variables: Name Value chosen_handler <trac.ticket.query.QueryModule object at 0x14174bcd0> chrome <trac.web.chrome.Chrome object at 0x14174bd90> err (<class trac.ticket.query.QuerySyntaxError at 0x140abe230>, ... handler <trac.ticket.query.QueryModule object at 0x14174bcd0> req <Request "GET u'/query'"> self <trac.web.main.RequestDispatcher object at 0x14174bc10> * File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 615, in process_request Code fragment: 610. user = email or name or None 611. 612. if user: 613. qstring = qstring.replace('$USER', user) 614. self.log.debug('QueryModule: Using default query: %s', qstring) 615. constraints = Query.from_string(self.env, qstring).constraints 616. # Ensure no field constraints that depend on $USER are used 617. # if we have no username. 618. for field, vals in constraints.items(): 619. for val in vals: 620. if val.endswith('$USER'): Local variables: Name Value constraints {} qstring u'status!=closed&owner=/C=FR/O=CNRS/OU=UMR8607/CN=Michel ... req <Request "GET u'/query'"> self <trac.ticket.query.QueryModule object at 0x14174bcd0> user u'/C=FR/O=CNRS/OU=UMR8607/CN=Michel ... * File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 97, in from_string Code fragment: 92. constraints = {} 93. cols = [] 94. for filter_ in filters: 95. filter_ = filter_.split('=') 96. if len(filter_) != 2: 97. raise QuerySyntaxError('Query filter requires field and ' 98. 'constraints separated by a "="') 99. field,values = filter_ 100. if not field: 101. raise QuerySyntaxError('Query filter requires field name') 102. # from last char of `field`, get the mode of comparison Local variables: Name Value cls <class 'trac.ticket.query.Query'> cols [] constraints {'status': [u'!closed']} env <trac.env.Environment object at 0x1414a3890> field 'status' filter_ [u'owner', u'/C', u'FR/O', u'CNRS/OU', u'UMR8607/CN', u'Michel ... filters [u'status!=closed', u'owner=/C=FR/O=CNRS/OU=UMR8607/CN=Michel ... kw {} kw_arys ['rows'] kw_bools ['desc', 'groupdesc', 'verbose'] kw_strs ['order', 'group', 'limit'] mode '' neg '!' processed_values [u'!closed'] string u'status!=closed&owner=/C=FR/O=CNRS/OU=UMR8607/CN=Michel ... val u'!closed' values u'closed' File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 419, in _dispatch_request dispatcher.dispatch(req) File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 196, in dispatch resp = chosen_handler.process_request(req) File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 615, in process_request constraints = Query.from_string(self.env, qstring).constraints File "/tmp_mnt/www/Web/servers/trac/0.11-b2/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 97, in from_string raise QuerySyntaxError('Query filter requires field and ' System Information: User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Trac: 0.11b2 Python: 2.4.1 (#4, Sep 15 2005, 16:38:29) [C] setuptools: 0.6c8 SQLite: 3.3.7 pysqlite: 2.3.2 Genshi: 0.5dev-r809 Subversion: 1.4.6 (r28521) jQuery: 1.2.3
Attachments (0)
Change History (4)
comment:1 by , 17 years ago
Component: | ticket system → report system |
---|---|
Owner: | changed from | to
Summary: | 0.11-b2 : QuerySyntaxError: Query filter requires field and constraints separated by a "=" → QuerySyntaxError: Query filter requires field and constraints separated by a "=" |
Version: | → 0.11b2 |
comment:2 by , 17 years ago
Keywords: | query added |
---|---|
Milestone: | 0.11 → 0.11.1 |
Priority: | normal → high |
comment:3 by , 16 years ago
Milestone: | 0.11.3 → 0.11.2 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in [7502]. Thanks for the bug report.
comment:4 by , 16 years ago
Owner: | changed from | to
---|
Note:
See TracTickets
for help on using tickets.
Well, yes, this is indeed going to be problematic.
The
replacement needs to be done a bit later.