wiki:TicketQuery

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: 0 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 75 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 0 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 0 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 8 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 1 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 9 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 12 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 165 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 0 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 270 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 0 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 0 [[TicketQuery(created=thismonth..,count)]]
Number of closed Firefox tickets: 0 [[TicketQuery(status=closed,keywords~=firefox,count)]]
Number of closed Opera tickets: 0 [[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: 0 [[TicketQuery(status=closed,keywords~=firefox|opera,count)]]
Number of tickets that affect Firefox or are closed and affect Opera: 0 [[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: #207, #275, #247 [[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 Brian Warner Brian Warner
Summary IRemoteReference(localobj) should provide something with .callRemote

Format: list

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

This is displayed as:

No results

[[TicketQuery(id=123)]]

This is displayed as:

#123
consider making RemoteException mode the default

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:

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:

Results (1 - 3 of 195)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#275 fixed tests fail against latest twisted-17.9.0: Failure is no longer pickleable Brian Warner
#274 fixed Tub.stopService returns a Deferred that may fire before all of the Tub's Brokers have disconnected Jean-Paul Calderone
#271 fixed `flappserver create` hangs forever Jean-Paul Calderone
1 2 3 4 5 6 7 8 9 10 11

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 195)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#275 fixed tests fail against latest twisted-17.9.0: Failure is no longer pickleable Brian Warner
Description

Unit tests are failing when run against the latest Twisted release (17.9.0). In this release, Failure now inherits from BaseException, which means it is no longer pickleable.

There are two sets of test failures. The first is in test_copyable where we explicitly try to round-trip a CopiedFailure through pickle:

[ERROR]
Traceback (most recent call last):
  File "/Users/warner/stuff/python/foolscap/src/foolscap/test/test_copyable.py", line 138, in _testFailure1_1
    p = pickle.dumps(f)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1380, in dumps
    Pickler(file, protocol).dump(obj)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 425, in save_reduce
    save(state)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 655, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 669, in _batch_setitems
    save(v)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 759, in save_global
    (obj, module, name))
pickle.PicklingError: Can't pickle <class exceptions.RuntimeError at 0x10e6a8c80>: it's not the same object as exceptions.RuntimeError

foolscap.test.test_copyable.Copyable.testFailure1

and the second is in the logging tests, where Failures are pickled into the serialized (internal) log buffers:

[ERROR]
Traceback (most recent call last):
  File "/Users/warner/stuff/python/foolscap/src/foolscap/eventual.py", line 26, in _turn
    cb(*args, **kwargs)
  File "/Users/warner/stuff/python/foolscap/src/foolscap/logging/log.py", line 484, in msg
    from_="local", rx_time=time.time())
  File "/Users/warner/stuff/python/foolscap/src/foolscap/logging/flogfile.py", line 20, in serialize_wrapper
    pickle.dump(wrapper, f)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1376, in dump
    Pickler(file, protocol).dump(obj)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 655, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 669, in _batch_setitems
    save(v)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 655, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 669, in _batch_setitems
    save(v)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 425, in save_reduce
    save(state)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 655, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 669, in _batch_setitems
    save(v)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 759, in save_global
    (obj, module, name))
pickle.PicklingError: Can't pickle <class foolscap.test.test_logging.SampleError at 0x10e8a7188>: it's not the same object as foolscap.test.test_logging.SampleError

foolscap.test.test_logging.Dumper.test_dump

I haven't seen evidence of these affecting actual use (the Tahoe unit tests are still passing), but it causes a FTBFS (Fails To Build From Source) error on both Debian and Ubuntu, and we need to fix this ASAP to about having Foolscap removed entirely from debian (and Tahoe too, along with all other downstream dependencies).

I've been meaning to replace pickle with JSON in the logging code for years now (#247, see also #4, #110, #130). I've got a few old branches, but I haven't looked at them for a long time, so I don't think they're ready for a quick fix. I'll dust them off and see what state they're in, but I think I might just remove exceptions from pickled logs entirely for now, and try to switch to JSON-based data in the next release.

#274 fixed Tub.stopService returns a Deferred that may fire before all of the Tub's Brokers have disconnected Jean-Paul Calderone
Description

Tub.stopService doesn't try to wait for the Brokers to disconnect. It merely calls shutdown on them. In most cases, because of the fireEventually, the Brokers will indeed have disconnected by the time stopService's Deferred fires. However, it's not guaranteed. And, indeed, it recently failed to happen and caused a Tahoe-LAFS CI failure leading to this ticket: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2896.

#271 fixed `flappserver create` hangs forever Jean-Paul Calderone
Description
$ flappserver --version                                                           
Foolscap version: 0.12.4
Twisted version: 16.5.0
$ flappserver create --location localhost:3116 /tmp/hang-forever
Server Running
Foolscap Application Server created in /tmp/hang-forever
TubID 2xfl6tpzc4uozbyg7bl27tygg3zsgjpg, listening on port tcp:3116
Now launch the daemon with 'flappserver start /tmp/hang-forever'
<time passes>
^CUnhandled error in Deferred:

This seems to be because of the interaction between run_flappserver and the defer.succeed(0) returned by Create.run. The Deferred has already fired so the callbacks run immediately, including the reactor.stop(), then the reactor gets run afterwards - and nothing ever stops it.

1 2 3 4 5 6 7 8 9 10 11


See also: TracQuery, TracTickets, TracReports

Last modified 3 years ago Last modified on 10/15/2018 06:21:35 PM