Edgewall Software

This page documents the 1.4 (latest stable) 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.

Usage

[[TicketQuery]]

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.

Examples

Example Result Macro
Number of Triage tickets: 22 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 1051 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 3 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 15 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 1510 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 1412 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 2182 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 987 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 4493 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 24 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 12230 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 1829 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 2 [[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: #13419, #10207, #13418 [[TicketQuery(max=3,order=modified,desc=1,compact)]]

Details of ticket #1:

[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]

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

Format: list

[[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

[[TicketQuery(id=123)]]

This is displayed as:

#123
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:

10

Format: progress

[[TicketQuery(milestone=0.12.8&group=type,format=progress)]]

This is displayed as:

defect

5 / 5

enhancement

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:

[[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 specify full rows using rows=<field>:

[[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 11161)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#13417 wontfix Trac 1.5.3 with uWSGI returns empty responses when error occured. seino
Description

Trac 1.5.3 with uWSGI returns empty responses when error occured.

Reproduction steps:

  1. run Trac 1.5.3 with a newly created environment.
  2. try the uwsgi_curl 127.0.0.1:8080 /. This should be success.
  3. try the uwsgi_curl 127.0.0.1:8080 /zzz. Trac returns an empty response.

Note that use uwsgi_curl to avoid the causes related to Nginx.

$ trac-admin test initenv
新規 Trac Environment /home/user/test の生成
..
$ cat > trac.ini << 'EOF'
[uwsgi]

master = true
processes = 2
plugins = python3
module = trac.web.main:dispatch_request
env = TRAC_ENV=/home/user/test
socket = 127.0.0.1:8080
EOF
$ uwsgi --ini trac.ini
[uWSGI] getting INI configuration from trac.ini
*** Starting uWSGI 2.0.18 (64bit) on [Fri Aug 27 07:19:29 2021] ***
compiled with version: 11.0.0 20210123 (Red Hat 11.0.0-0) on 27 January 2021 00:00:00
os: Linux-5.13.12-200.fc34.x86_64 #1 SMP Wed Aug 18 13:27:18 UTC 2021
nodename: hostname
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/user
detected binary path: /usr/sbin/uwsgi
your processes number limit is 3697
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8080 fd 5
Python version: 3.9.6 (default, Jul 16 2021, 00:00:00)  [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x199af50
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 218760 bytes (213 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x199af50 pid: 100426 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 100426)
spawned uWSGI worker 1 (pid: 100427, cores: 1)
spawned uWSGI worker 2 (pid: 100428, cores: 1)
[pid: 100427|app: 0|req: 1/1]  () {16 vars in 159 bytes} [Fri Aug 27 07:19:32 2021] GET / => generated 9147 bytes in 759 msecs (HTTP/1.1 200) 5 headers in 310 bytes (0 switches on core 0)
[pid: 100428|app: 0|req: 1/2]  () {16 vars in 165 bytes} [Fri Aug 27 07:19:35 2021] GET /zzz => generated 0 bytes in 689 msecs (HTTP/1.1 404) 5 headers in 317 bytes (0 switches on core 0)
#13415 fixed tracd is redirecting to http when using https Jun Omae jkoan@…
Description

Hi,

we are using tracd for a small internal team on a non standard port. Recently we switched to https for internal reasons. So we added the required parameters to tracd and restarted. At first glance everything was fine. But after some days we noticed that sometimes Trac was sending us back to http. First we thought about the browser cache. But after some debugging I found out that trac was redirecting us to http via the Location http header.

The first solution was to switch use_base_url_for_redirect on inside [trac] But due to the concerns about use_base_url_for_redirect from the docs i wanted to find a better solution.

So i debugged and found out that the scheme=http is set from the WSGIGateway.__init__ where some additional checks are also performt. One of those is if the environment has the Variable HTTPS set to "yes". So i added a workaround to tracd (trac.web.standalone)

I added the following to the case where httpd.socket = ssl.wrap_socket(...) is also called as this seems appropriate.

httpd.environ["HTTPS"]="yes"
#13409 fixed repository_dir record for Subversion is wrong Jun Omae Jun Omae
Description

The repository_dir should be svn:92ea810a-adf3-0310-b540-bef912dcf5ba:/home/jun66j5/var/svn/svnrepos.

sqlite> select * from repository;
1|name|
1|dir|/home/jun66j5/var/svn/svnrepos
1|type|svn
1|repository_dir|svn:b'92ea810a-adf3-0310-b540-bef912dcf5ba':/home/jun66j5/var/svn/svnrepos
1|youngest_rev|31
1 2 3 4 5 6 7 8 9 10 11


See also: TracQuery, TracTickets, TracReports

Last modified 2 years ago Last modified on Oct 15, 2019, 6:35:53 AM
Note: See TracWiki for help on using the wiki.