Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#10979 closed enhancement (fixed)

Allow dynamic variables to be used in a report title and description

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:
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.

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

Attachments (3)

t10979-r11481-1.patch (8.6 KB ) - added by Ryan J Ollos <ryan.j.ollos@…> 6 years ago.
Patch against r11481 of the trunk.
t10979-r11481-2.patch (9.7 KB ) - added by Ryan J Ollos <ryan.j.ollos@…> 6 years ago.
Patch against r11481 of the trunk.
t10979-r11481-3.patch (9.8 KB ) - added by Ryan J Ollos <ryan.j.ollos@…> 6 years ago.
Patch against r11481 of the trunk.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 6 years ago by Remy Blank

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

Sounds like a good idea.

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

Description: modified (diff)

Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

Attachment: t10979-r11481-1.patch added

Patch against r11481 of the trunk.

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

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 Changed 6 years ago by Remy Blank

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 6 years ago by Remy Blank (previous) (diff)

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

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.

Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

Attachment: t10979-r11481-2.patch added

Patch against r11481 of the trunk.

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

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

comment:7 Changed 6 years ago by Remy Blank

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

Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

Attachment: t10979-r11481-3.patch added

Patch against r11481 of the trunk.

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

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 Changed 6 years ago by Remy Blank

Milestone: next-dev-1.1.x1.1.1

comment:10 Changed 6 years ago by Remy Blank

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 Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

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

Thanks! TracReports has been updated.

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

I didn't mention the new tester.go_to_report method in the API Changes, but if that should be done just let me know.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos <ryan.j.ollos@…>.
The resolution will be deleted.
to The owner will be changed from Ryan J Ollos <ryan.j.ollos@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.