Edgewall Software

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

Filters

When you first go to the query page the default filters will display all open tickets, or if you're logged in it will display open tickets assigned to you. Current filters can be removed by clicking the button to the right with the minus sign on the label. New filters are added from the pulldown list in the bottom-right corner of the filters box. Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back to Query links after saving your results. When you return to the query any tickets which were edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

While Trac does not yet allow saving a named query and somehow making it available in a navigable list, you can save references to queries in Wiki content, as described below.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria (see Query Language).

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Using the [[TicketQuery]] Macro

The TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.

Example:

[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

This is displayed as:

#181
Wiki preview injects new lines
#204
request for colour legend (or something similar) for ticket groups in reports
#226
Ticket Dependencies
#239
Link to diff of specifik wiki change instead of the page itself
#351
All ticket modifications should be tracked in timeline
#413
Installing on Windows, drive other than C:
#450
Diffviewer should try to convert the text into utf-8.
#475
merging of similar tickets
#519
Python process sometimes hangs on Windows Server 2003
#529
IE 5-6 over HTTPS broken downloads

Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language.

A more compact representation without the ticket summaries is also available:

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

#181, #204, #226, #239, #351, #413, #450, #475, #519, #529

Finally if you wish to receive only the number of defects that match the query using the count parameter.

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:

10

Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field> - you can specify multiple fields and what order they are displayed by placing pipes (|) between the columns like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Full rows

In table format you can also have full rows by using rows=<field> like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 7139)

Ticket Resolution Summary Owner Reporter
#8450 invalid Support of several hotkeys for the same action ivanov-jr@…

Reported by ivanov-jr@…, 10 hours ago.

description

It is great that VLC has ability to change hotkeys to whatever user want and has a habit to. But almost all laptops(and usual keyboards) now have media keys and it is convenient sometimes to use them.

In the same time we do not want to change existent hotkeys binding for usual keyboard, to override them by media buttons.

It will be very convenient to set up few hotkeys for one action, for example Play/Pause - "Space" and "Media Play Pause".

It will be convenient also for few users of the same PC, they have different hotkeys habits but VLC will easily reconcile this family problem.

#8449 invalid InterfaceError: Error binding parameter 0 - probably unsupported type. boooch

Reported by boooch, 11 hours ago.

description

How to Reproduce

I have just install UserManagerPlugin?.When I want click to Users I have an error:

While doing a GET operation on /admin/accounts/users, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'cat_id': u'accounts', 'panel_id': u'users', 'path_info': None}

User Agent was: Opera/9.63 (Windows NT 5.1; U; ru) Presto/2.1.1

System Information

Trac 0.11.1
Python 2.5.2 (r252:60911, Aug 8 2008, 09:22:44)
[GCC 4.3.1]
setuptools 0.6c9
SQLite 3.5.9
pysqlite 2.4.1
Genshi 0.5
Pygments 0.10
Subversion 1.5.1 (r32289)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  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 219, in dispatch
    data, content_type)
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 715, in render_template
    return stream.render(method, doctype=doctype)
  File "/var/lib/python-support/python2.5/genshi/core.py", line 179, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/var/lib/python-support/python2.5/genshi/output.py", line 60, in encode
    return _encode(u''.join(list(iterator)))
  File "/var/lib/python-support/python2.5/genshi/output.py", line 311, in __call__
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/output.py", line 753, in __call__
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/output.py", line 592, in __call__
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/output.py", line 698, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/var/lib/python-support/python2.5/genshi/output.py", line 532, in __call__
    for ev in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 767, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 756, in _generate
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-i686/egg/timingandestimationplugin/tande_filters.py", line 60, in __call__
    for mark, event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 713, in __call__
    for mark, event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 682, in _mark
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-i686/egg/timingandestimationplugin/tande_filters.py", line 60, in __call__
    for mark, event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 713, in __call__
    for mark, event in stream:
  File "/var/lib/python-support/python2.5/genshi/filters/transform.py", line 682, in _mark
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 299, in _match
    ctxt, match_templates[idx + 1:], **vars):
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 299, in _match
    ctxt, match_templates[idx + 1:], **vars):
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 299, in _match
    ctxt, match_templates[idx + 1:], **vars):
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 246, in _match
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 533, in _eval
    for event in substream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/path.py", line 141, in _generate
    subevent = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 235, in _strip
    event = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 533, in _eval
    for event in substream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/path.py", line 141, in _generate
    subevent = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 246, in _match
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 235, in _strip
    event = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 533, in _eval
    for event in substream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/path.py", line 141, in _generate
    subevent = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/markup.py", line 235, in _strip
    event = stream.next()
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 558, in _flatten
    for event in self._flatten(substream, ctxt, **vars):
  File "/var/lib/python-support/python2.5/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/var/lib/python-support/python2.5/genshi/template/directives.py", line 377, in __call__
    for item in iterable:
  File "/usr/lib/python2.5/site-packages/trac/util/compat.py", line 81, in next
    self.currkey = self.keyfunc(self.currvalue)
  File "<string>", line 1, in <lambda.20>
  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 114, in has_user
    if store.has_user(user):
  File "build/bdist.linux-i686/egg/acct_mgr/db.py", line 39, in has_user
    "AND sid=%s", (user,))
  File "/usr/lib/python2.5/site-packages/trac/db/util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.5/site-packages/trac/db/sqlite_backend.py", line 58, in execute
    args or [])
  File "/usr/lib/python2.5/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.

#8447 invalid TypeError: unhashable type: 'list' ristok

Reported by ristok, 14 hours ago.

description

How to Reproduce

While doing a POST operation on /agilo-backlog, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'3_ts': u'2009-07-03 11:34:17+00:00',
 '4_ts': u'2009-07-03 11:36:10+00:00',
 '5_ts': u'2009-07-03 11:37:15+00:00',
 '__FORM_TOKEN': u'e6ac0dbf85d2e2221e76fd07',
 'chk_3': u'on',
 'col_3_rd_points': u'2',
 'col_3_story_priority': u'Mandatory',
 'col_4_rd_points': u'2',
 'col_4_story_priority': u'Mandatory',
 'col_5_rd_points': u'2',
 'col_5_story_priority': u'Mandatory',
 'delete': u'Delete Selected',
 'name': [u'Product Backlog', u'Product Backlog'],
 'pos_3': u'0',
 'pos_4': u'1',
 'pos_5': u'2'}

User Agent was: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)

System Information

Trac 0.11.1
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3]
setuptools 0.6c9
SQLite 3.6.10
pysqlite 2.5.0
Genshi 0.5.1
Pygments 0.10
Agilo 0.7.4.1-r1624-20090611
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.6/dist-packages/agilo-0.7.4.1_r1624_20090611-py2.4.egg/agilo/scrum/web_ui/backlog.py", line 229, in process_request
    backlog = self._load_backlog(req, data)
  File "/usr/local/lib/python2.6/dist-packages/agilo-0.7.4.1_r1624_20090611-py2.4.egg/agilo/scrum/web_ui/backlog.py", line 308, in _load_backlog
    backlog = self._backlogs.get(backlog_name)
TypeError: unhashable type: 'list'

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values.

The available operators are:

= the field content exactly matches the one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

See also: TracTickets, TracReports, TracGuide