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: 505 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 505 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 0 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 549 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 5306 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 1089 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 4429 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 4255 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 19169 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 1054 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 36314 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 1488 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 23 [[TicketQuery(created=thismonth..,count)]]
Number of closed Firefox tickets: 8 [[TicketQuery(status=closed,keywords~=firefox,count)]]
Number of closed Opera tickets: 26 [[TicketQuery(status=closed,keywords~=opera,count)]]
Number of closed tickets affecting Firefox and Opera: 0 [[TicketQuery(status=closed,keywords~=firefox opera,count)]]
Number of closed tickets affecting Firefox or Opera: 34 [[TicketQuery(status=closed,keywords~=firefox|opera,count)]]
Number of tickets that affect Firefox or are closed and affect Opera: 34 [[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]
Number of closed Firefox tickets that don't affect Opera: 0 [[TicketQuery(status=closed,keywords~=firefox -opera,count)]]
Last 3 modified tickets: #37065, #37100, #32969 [[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 Jacob Adrian Holovaty
Summary Create architecture for anonymous sessions

Format: list

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

This is displayed as:

No results

[[TicketQuery(id=123)]]

This is displayed as:

#123
Typo in the model_api/#field-types

Format: compact

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

This is displayed as:

No results

Format: count

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

This is displayed as:

0

Format: progress

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

This is displayed as:

Uncategorized

2043 / 2044

Bug

10583 / 10944

New feature

3873 / 4257

Cleanup/optimization

5546 / 5853

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 in 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 35260)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#37098 fixed Add dynamically linked binary environment variables to tox config. Vaibhav Pant Johannes Maron
Description

I am always running into issues when I install a fresh py3 environment via tox on Darwin arm64 with homebrew:

tox -re py3

I'd like to extend tox's passenv configuration with

  • LIBMEMCACHED,
  • GDAL_LIBRARY_PATH,
  • and GEOS_LIBRARY_PATH.

All of those are commonly used to locate linked binaries.

I am currently doing those changes locally and always have to remember not to commit them.

Therefore, I'd like to commit them once and merge them into main :P

#37096 fixed test_invalid_choice_db_option fails on Python 3.14.5+ Kasey Kasey
Description

On Python 3.14.5+, admin_scripts.tests.CommandDBOptionChoiceTests.test_invalid_choice_db_option fails with:

AssertionError: "Error: argument --database: invalid choice: 'deflaut',
maybe you meant 'default'\? \(choose from default, other\)" does not match
"Error: argument --database: invalid choice: 'deflaut', maybe you meant
'default'? (choose from 'default', 'other')"

Cause

CPython 3.14.5 restored quoting of choice values in argparse's "invalid choice" error messages via cpython#149385 (3.14 backport of cpython#130751, tracked in cpython#130750). The choices formatter changed from:

'choices': ', '.join(map(str, action.choices))           # 3.14.0–3.14.4

to:

'choices': ', '.join(repr(str(choice)) for choice in action.choices)  # 3.14.5+

so the message goes from (choose from default, other) to (choose from 'default', 'other').

The PY314 branch of the test (added in commit b1a65eac7c, fixing #36321) expected the unquoted form. The pre-3.14 branch already handles both forms via '?default'?, '?other'?; aligning the PY314 branch with the same pattern fixes the test on all Python 3.14.x releases.

Scope

main only. stable/6.0.x and stable/5.2.x are unaffected — neither branch enables suggest_on_error (added in #36321 on main), and both already use the flexible '?default'?, '?other'? pattern.

Patch

Patch ready (one-line test regex fix). PR link will follow in a comment once the ticket is accepted.

#37095 fixed URL redirect max length check should check %-encoded value Jacob Walls Jacob Walls
Description

In #36767 we made configurable the length check on redirect URLs we added for CVE-2025-64458. "Cowork" sent us a flurry of nuisance security reports last night, but among them was a reasonable suggestion that we apply the length check against the percent-encoded URI:

  • django/http/response.py

    diff --git a/django/http/response.py b/django/http/response.py
    index 45fb0177d1..0a61fb723f 100644
    a b class HttpResponseRedirectBase(HttpResponse):  
    641641        **kwargs,
    642642    ):
    643643        super().__init__(*args, **kwargs)
    644         self["Location"] = iri_to_uri(redirect_to)
    645644        redirect_to_str = str(redirect_to)
    646         if max_length is not None and len(redirect_to_str) > max_length:
     645        location = iri_to_uri(redirect_to_str)
     646        if max_length is not None and len(location) > max_length:
    647647            raise DisallowedRedirect(
    648648                f"Unsafe redirect exceeding {max_length} characters"
    649649            )
     650        self["Location"] = location
    650651        parsed = urlsplit(redirect_to_str)
    651652        if preserve_request:
    652653            self.status_code = self.status_code_preserve_request
  • tests/httpwrappers/tests.py

    diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
    index b990e9f816..3430dbbcd3 100644
    a b from django.http import (  
    2424    parse_cookie,
    2525)
    2626from django.test import SimpleTestCase
     27from django.utils.encoding import iri_to_uri
    2728from django.utils.functional import lazystr
    2829from django.utils.http import MAX_URL_REDIRECT_LENGTH
    2930
    class HttpResponseTests(SimpleTestCase):  
    498499                response = response_class(long_url)
    499500                self.assertEqual(response.url, long_url)
    500501
     502    def test_redirect_url_max_length_checks_encoded_location(self):
     503        long_url = "/" + "é" * (MAX_URL_REDIRECT_LENGTH - 1)
     504        self.assertLessEqual(len(long_url), MAX_URL_REDIRECT_LENGTH)
     505        self.assertGreater(len(iri_to_uri(long_url)), MAX_URL_REDIRECT_LENGTH)
     506        for response_class in (HttpResponseRedirect, HttpResponsePermanentRedirect):
     507            with (
     508                self.subTest(response_class=response_class),
     509                self.assertRaisesMessage(
     510                    DisallowedRedirect,
     511                    f"Unsafe redirect exceeding {MAX_URL_REDIRECT_LENGTH} characters",
     512                ),
     513            ):
     514                response_class(long_url)
     515
     516    def test_redirect_url_max_length_allows_encoded_location_at_limit(self):
     517        redirect_to = "/" + "é" * ((MAX_URL_REDIRECT_LENGTH - 1) // 6)
     518        location = iri_to_uri(redirect_to)
     519        self.assertLessEqual(len(location), MAX_URL_REDIRECT_LENGTH)
     520        for response_class in (HttpResponseRedirect, HttpResponsePermanentRedirect):
     521            with self.subTest(response_class=response_class):
     522                response = response_class(redirect_to)
     523                self.assertEqual(response.url, location)
     524
    501525    def test_redirect_url_max_length_override_via_param(self):
    502526        base_url = "https://example.com/"
    503527        for (max_length, length), response_class in itertools.product(

Although we didn't take this as a security issue (the limit we apply on the raw value is good enough for DoS), this seems like a functionality bug to fix before the release.

1 2 3 4 5 6 7 8 9 10 11


See also: TracQuery, TracTickets, TracReports

Last modified 2 years ago Last modified on Jan 24, 2024, 9:58:09 AM
Note: See TracWiki for help on using the wiki.
Back to Top