Edgewall Software

This page documents the 1.2 release. Documentation for other releases can be found here.

TicketQuery Wiki Macro

The TicketQuery macro lets you display ticket information anywhere that accepts WikiFormatting. The query language used by the [[TicketQuery]] macro is described in the TracQuery page.



Wiki macro listing tickets that match certain criteria.

This macro accepts a comma-separated list of keyed parameters, in the form "key=value".

If the key is the name of a field, the value must use the syntax of a filter specifier as defined in TracQuery#QueryLanguage. Note that this is not the same as the simplified URL syntax used for query: links starting with a ? character. Commas (,) can be included in field values by escaping them with a backslash (\).

Groups of field constraints to be OR-ed together can be separated by a literal or argument.

In addition to filters, several other named parameters can be used to control how the results are presented. All of them are optional.

The format parameter determines how the list of tickets is presented:

  • list — the default presentation is to list the ticket ID next to the summary, with each ticket on a separate line.
  • compact — the tickets are presented as a comma-separated list of ticket IDs.
  • count — only the count of matching tickets is displayed
  • rawcount — only the count of matching tickets is displayed, not even with a link to the corresponding query (since 1.1.1)
  • table — a view similar to the custom query view (but without the controls)
  • progress — a view similar to the milestone progress bars

The max parameter can be used to limit the number of tickets shown (defaults to 0, i.e. no maximum).

The order parameter sets the field used for ordering tickets (defaults to id).

The desc parameter indicates whether the order of the tickets should be reversed (defaults to false).

The group parameter sets the field used for grouping tickets (defaults to not being set).

The groupdesc parameter indicates whether the natural display order of the groups should be reversed (defaults to false).

The verbose parameter can be set to a true value in order to get the description for the listed tickets. For table format only. deprecated in favor of the rows parameter

The rows parameter can be used to specify which field(s) should be viewed as a row, e.g. rows=description|summary

The col parameter can be used to specify which fields should be viewed as columns. For table format only.

For compatibility with Trac 0.10, if there's a last positional parameter given to the macro, it will be used to specify the format. Also, using "&" as a field separator still works (except for order) but is deprecated.


Example Result Macro
Number of Triage tickets: 21 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 1055 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 3 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 18 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 1516 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 1415 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 2182 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 990 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 4505 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 23 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 12270 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 1842 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 0 [[TicketQuery(created=thismonth..,count)]]
Number of closed Firefox tickets: 13 [[TicketQuery(status=closed,keywords~=firefox,count)]]
Number of closed Opera tickets: 12 [[TicketQuery(status=closed,keywords~=opera,count)]]
Number of closed tickets affecting Firefox and Opera: 1 [[TicketQuery(status=closed,keywords~=firefox opera,count)]]
Number of closed tickets affecting Firefox or Opera: 24 [[TicketQuery(status=closed,keywords~=firefox|opera,count)]]
Number of tickets that affect Firefox or are closed and affect Opera: 25 [[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]
Number of closed Firefox tickets that don't affect Opera: 1 [[TicketQuery(status=closed,keywords~=firefox -opera,count)]]
Last 3 modified tickets: #13333, #12984, #13476 [[TicketQuery(max=3,order=modified,desc=1,compact)]]

Details of ticket #1:


Ticket Owner Reporter
#1 anonymous
Summary Add a new project summary module.

Format: list


This is displayed as:

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


This is displayed as:

No SQL error display

Format: compact

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

This is displayed as:

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

Format: count

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

This is displayed as:


Format: progress


This is displayed as:


5 / 5


2 / 2

Format: table

You can choose the columns displayed in the table format (format=table) using col=<field>. You can specify multiple fields and the order they are displayed by placing pipes (|) between the columns:


This is displayed as:

Full rows

In table format you can specify full rows using rows=<field>:


This is displayed as:

Results (1 - 3 of 11194)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#13481 fixed Tigris.org no longer supported: affects svn interwiki link figaro

Subversion hosting has been migrated from tigris.org to apache.org: https://subversion.apache.org/ However, both InterWiki and InterMapTxt mention the support for the format where the former site is still used. On t.e.o. the amount of occurrences is small: 3 occurrences with the most recent one from 2014.


  • Trac administrators need to decide whether to backport to older tickets via apache.org, for example the issue with id 4526 to resolve to https://issues.apache.org/jira/browse/SVN-4526?issueNumber=4526
  • As the Trac development community we need to decide whether to support/change the url for full compatibility or drop support for older tickets.
#13479 fixed make extraction fails with TypeError Jun Omae Ryan J Ollos
$ make status

Python: /Users/rjollos/.pyenv/shims/python

/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
  Package        Version
  Python       : 3.10.3 (main, Mar 22 2022, 21:01:41) [Clang 13.1.6 (clang-1316.0.21.2)]
  Setuptools   : 62.1.0
  Pip          : 22.0.4
  Wheel        : 0.37.1
  Jinja2       : 3.0.3
  Babel        : 2.9.1
  sqlite3      : 2.6.0 (3.36.0)
  PySqlite3    : not installed
  PyMySQL      : 1.0.2
  Psycopg2     : 2.9.3 (dt dec pq3 ext lo64)
  SVN bindings : 1.15.0 (under development)
  Mercurial    : 6.1
  Pygments     : 2.11.2
  Textile      : 4.0.2
  Pytz         : 2022.1
  Docutils     : 0.17.1
  Selenium     : 4.1.3
  PyTidyLib    : 0.3.2 (5.8.0 /usr/local/lib/libtidy.dylib)
  LXML         : 4.8.0
  coverage     : 6.3.2

  PATH=/Users/rjollos/Documents/Workspace/trac-dev/bin:/Users/rjollos/Documents/Workspace/trac-dev/subversion-trunk/local/bin:/usr/local/Cellar/tidy-html5/5.6.0/bin:/Users/rjollos/.pyenv/shims:/usr/local/opt/sqlite/bin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/munki:/opt/X11/bin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Users/rjollos/.pyenv/bin
  server-options= -p 8000 -a '*,/Users/rjollos/Documents/Workspace/trac-dev/tracenvs/htdigest.trac,trac' -r -e /Users/rjollos/Documents/Workspace/trac-dev/tracenvs

External dependencies:
  Git version: git version 2.35.1
  Subversion version: 1.15.0-dev
$ make extraction
python  setup.py  extract_messages  extract_messages_js  extract_messages_tracini
running extract_messages
extracting messages from tracopt/__init__.py
extracting messages from tracopt/perm/__init__.py
extracting messages from tracopt/perm/authz_policy.py
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/setup.py", line 42, in <module>
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
    return run_commands(dist)
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/babel/messages/frontend.py", line 481, in run
    for filename, lineno, message, comments, context in extracted:
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/babel/messages/extract.py", line 149, in extract_from_dir
    for message_tuple in check_and_call_extract_file(
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/babel/messages/extract.py", line 207, in check_and_call_extract_file
    for message_tuple in extract_from_file(
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/babel/messages/extract.py", line 243, in extract_from_file
    return list(extract(method, fileobj, keywords, comment_tags,
  File "/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/babel/messages/extract.py", line 325, in extract
    for lineno, funcname, messages, comments in results:
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/dist.py", line 148, in extract_python
    for _ in tokens:
  File "/Users/rjollos/.pyenv/versions/3.10.3/lib/python3.10/tokenize.py", line 498, in _tokenize
    if line[pos] in '#\r\n':           # skip comments or blank lines
TypeError: 'in <string>' requires string as left operand, not int
make: *** [extraction] Error 1
#13477 fixed ImportError: cannot import name 'contextfilter' from 'jinja2' Jun Omae Ryan J Ollos
$ pip list | grep Jinja
Jinja2                        3.1.1
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/contrib/checkwiki.py", line 22, in <module>
    from trac.test import EnvironmentStub, Mock, MockPerm
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/test.py", line 47, in <module>
    from trac.env import Environment
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/env.py", line 52, in <module>
    from trac.web.chrome import Chrome
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/web/chrome.py", line 40, in <module>
    from trac.mimeview.api import RenderingContext, get_mimetype
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/mimeview/__init__.py", line 14, in <module>
    from trac.mimeview.api import *
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/mimeview/api.py", line 70, in <module>
    from trac.resource import Resource
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/resource.py", line 21, in <module>
    from trac.util.presentation import classes
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/presentation.py", line 24, in <module>
    from jinja2 import Undefined, contextfilter, evalcontextfilter
ImportError: cannot import name 'contextfilter' from 'jinja2' (/Users/rjollos/.pyenv/versions/trac-py310/lib/python3.10/site-packages/jinja2/__init__.py)
make: *** [update-help] Error 1
1 2 3 4 5 6 7 8 9 10 11

See also: TracQuery, TracTickets, TracReports

Last modified 3 years ago Last modified on Oct 15, 2019, 6:32:29 AM
Note: See TracWiki for help on using the wiki.