[Pkg-trac-devel] Bug#494132: [trac] custom queries are broken

Matthieu Baechler matthieu.baechler at woonoz.com
Thu Aug 7 12:13:48 UTC 2008


Package: trac
Version: 0.11-3
Severity: normal

--- Please enter the report below this line. ---

When going into View Tickets -> Custom Query, I get the following error :


Trac detected an internal error: 
QuerySyntaxError: Query filter requires field and constraints separated by a "="

Python Traceback
Most recent call last: 
      * File "/usr/lib/python2.5/site-packages/trac/web/main.py", line
        423, in _dispatch_request 
        Code fragment:
             1. try:
             2. if not env and env_error:
             3. raise HTTPInternalError(env_error)
             4. try:
             5. dispatcher = RequestDispatcher(env)
             6. dispatcher.dispatch(req)
             7. except RequestDone:
             8. pass
             9. resp = req._response or []
            10.  
            11. except HTTPException, e:
Local variables:
                Name
               Value
               after
[u' except RequestDone:', u' pass',
u' resp = ...
               before
[u' try:', u' if not env and
env_error:', u' raise ...
             dispatcher
<trac.web.main.RequestDispatcher
object at 0x8b1252c>
                 e
QuerySyntaxError('Query filter
requires field and constraints
separated by ...
                env
<trac.env.Environment object at
0x870bb8c>
             env_error
None
              exc_info
(<class
'trac.ticket.query.QuerySyntaxError'>, QuerySyntaxError('Query ...
              filename
'/usr/lib/python2.5/site-packages/trac/web/main.py'
               frames
[{'function': '_dispatch_request',
'lines_before': [u' try:', u' ...
             has_admin
True
                line
u' dispatcher.dispatch(req)'
               lineno
422
              message
u'QuerySyntaxError: Query filter
requires field and constraints
separated ...
                req
<Request "GET u'/query'">
                resp
[]
                 tb
<traceback object at 0x8fff02c>
              tb_hide
None
             traceback
'Traceback (most recent call last):
\n File ...
  * File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 197,
    in dispatch 
Code fragment:
     1. req.args.get('__FORM_TOKEN') != req.form_token:
     2. raise HTTPBadRequest('Missing or invalid form token. '
     3. 'Do you have cookies enabled?')
     4.  
     5. # Process the request and render the template
     6. resp = chosen_handler.process_request(req)
     7. if resp:
     8. if len(resp) == 2: # Clearsilver
     9. chrome.populate_hdf(req)
    10. template, content_type = \
    11. self._post_process_request(req, *resp)
Local variables:
                Name
               Value
           chosen_handler
<trac.ticket.query.QueryModule
object at 0x8b125ac>
               chrome
<trac.web.chrome.Chrome object at
0x8a9aa6c>
                err
(<class
'trac.ticket.query.QuerySyntaxError'>, QuerySyntaxError('Query ...
              handler
<trac.ticket.query.QueryModule
object at 0x8b125ac>
                req
<Request "GET u'/query'">
                self
<trac.web.main.RequestDispatcher
object at 0x8b1252c>
  * File "/usr/lib/python2.5/site-packages/trac/ticket/query.py", line
    764, in process_request 
Code fragment:
     1. user = email or name or None 
     3. if user: 
     4. qstring = qstring.replace('$USER', user) 
     5. self.log.debug('QueryModule: Using default query: %s',
        str(qstring)) 
     6. constraints = Query.from_string(self.env, qstring).constraints 
     7. # Ensure no field constraints that depend on $USER are used 
     8. # if we have no username. 
     9. for field, vals in constraints.items(): 
    10. for val in vals: 
    11. if val.endswith('$USER'): 
Local variables:
                Name
               Value
            constraints
{}
              qstring
u'status!=closed&owner=/CN=matthieu'
                req
<Request "GET u'/query'">
                self
<trac.ticket.query.QueryModule
object at 0x8b125ac>
                user
'/CN=matthieu'
  * File "/usr/lib/python2.5/site-packages/trac/ticket/query.py", line
    135, in from_string 
Code fragment:
     1. constraints = {}
     2. cols = []
     3. for filter_ in filters:
     4. filter_ = filter_.split('=')
     5. if len(filter_) != 2:
     6. raise QuerySyntaxError(_('Query filter requires field and ' 
     7. 'constraints separated by a "="'))
     8. field,values = filter_
     9. if not field:
    10. raise QuerySyntaxError(_('Query filter requires field name'))
    11. # 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
0x870bb8c>
               field
'status'
              filter_
[u'owner', u'/CN', u'matthieu']
              filters
[u'status!=closed',
u'owner=/CN=matthieu']
                 kw
{}
              kw_arys
['rows']
              kw_bools
['desc', 'groupdesc', 'verbose']
              kw_strs
['order', 'group', 'page', 'max']
                mode
''
                neg
'!'
          processed_values
[u'!closed']
               string
u'status!=closed&owner=/CN=matthieu'
                val
u'!closed'
               values
u'closed'
File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 423, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 197, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/trac/ticket/query.py", line 764, in process_request
  constraints = Query.from_string(self.env, qstring).constraints 
File "/usr/lib/python2.5/site-packages/trac/ticket/query.py", line 135, in from_string
  raise QuerySyntaxError(_('Query filter requires field and ' 




System Information:
               Trac:
0.11
              Python:
2.5.2 (r252:60911, May 28 2008,
08:53:53) [GCC 4.2.4 (Debian
4.2.4-1)]
            setuptools:
0.6c8
              SQLite:
3.5.9
             pysqlite:
2.4.1
              Genshi:
0.5
            mod_python:
3.3.1
            Subversion:
1.5.1 (r32289)






More information about the Pkg-trac-devel mailing list