Edgewall Software

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10979 closed enhancement (fixed)

Allow dynamic variables to be used in a report title and description — at Version 11

Reported by: Ryan J Ollos <ryan.j.ollos@…> Owned by: Ryan J Ollos <ryan.j.ollos@…>
Priority: normal Milestone: 1.1.1
Component: report system Version:
Severity: normal Keywords: bitesized
Cc: Branch:
Release Notes:

Dynamic variables can be used in the report title and description.

API Changes:

New function sub_vars in trac.util.text for substituting $XYZ-style variables in a string.

Internal Changes:

Description (last modified by Ryan J Ollos <ryan.j.ollos@…>)

It would be useful to be able to use dynamic variables in the report title and description. Some use cases for this were discussed in th:#10488. Here are some examples of how it could be used in the title:

  • Tickets for $COMPONENT
  • $STATUS tickets for milestone $MILESTONE
  • Tickets for $USER

Change History (14)

comment:1 by Remy Blank, 11 years ago

Keywords: bitesized added
Milestone: next-dev-1.1.x

Sounds like a good idea.

comment:2 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Description: modified (diff)

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: t10979-r11481-1.patch added

Patch against r11481 of the trunk.

comment:3 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Here is a patch that implements the feature. I took the opportunity to also add license headers to all of the modified files that were lacking them.

comment:4 by Remy Blank, 11 years ago

Owner: set to Remy Blank
Status: newassigned

Looks good. Could you please move the variable-substitution function and the corresponding regexp into trac.util.text? I'm sure we can re-use this.

Last edited 11 years ago by Remy Blank (previous) (diff)

in reply to:  4 comment:5 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Replying to rblank:

Looks good. Could you please move the variable-substitution function and the corresponding regexp into trac.util.text?

Sure, thanks for the review. I'll refresh the patch shortly.

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: t10979-r11481-2.patch added

Patch against r11481 of the trunk.

comment:6 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Here is the refreshed patch. I'll follow up quickly if you spot any other changes that should be made.

comment:7 by Remy Blank, 11 years ago

Nitpick: please move the re.compile() out of the function and store it in a global _sub_vars_re variable.

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: t10979-r11481-3.patch added

Patch against r11481 of the trunk.

comment:8 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Done in latest patch. I positioned the variable just above the function in which it was used since I saw the same done elsewhere in the file.

After this is committed, I'll add a line or two to TracReports#AdvancedReports:DynamicVariables in order to document the feature.

comment:9 by Remy Blank, 11 years ago

Milestone: next-dev-1.1.x1.1.1

comment:10 by Remy Blank, 11 years ago

Owner: changed from Remy Blank to Ryan J Ollos <ryan.j.ollos@…>

Slightly modified patch applied in [11533] (made sub_vars_re public and used it in the report code, and URL-quoted the values in go_to_report()).

Ryan, I'm reassigning this to you to update TracReports and to add the "Release Notes" field in this ticket. Please close when this is done.

comment:11 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

API Changes: modified (diff)
Description: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks! TracReports has been updated.

Note: See TracTickets for help on using tickets.