Opened 6 years ago

Last modified 3 months ago

#9048 new enhancement

[RFC][PATCH] Policer extension point, and improvement on user preference box programming

Reported by: Patrick Schaaf Owned by:
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 0.11


This is a request for comments, and a moderately large patch to serve as a foundation for the request.

The focus is on improvements to the user preference panels, and especially on a new way to selectively remove subscribers, before announcements are distributed, under various conditions.

My trac installation and development system is still running 0.11.7, so I'm making these changes against the 0.11/ branch of AnnouncerPlugin, in the hope that code did not diverge too much to make this useless.

I'll create this ticket with the patch attached, then write a comment with more elaboration on the contained features.

I'm looking forward to any comments you might have, and directions on how likely it is to get this integrated.

Attachments (3)

announcerplugin-policer-and-shared-prefs-boxes.patch (27.9 KB) - added by Patrick Schaaf 6 years ago.
minimal updates
announcerplugin-policer-and-shared-prefs-boxes-V2.patch (32.1 KB) - added by Patrick Schaaf 6 years ago.
respin - now with revert-user-settings-to-defaults functionality
policer-settings.png (30.7 KB) - added by Patrick Schaaf 6 years ago.
teaser - this is how the policer settings box looks like now

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by Patrick Schaaf

Ground covered:


A new extension point, IAnnouncementPolicer, is provided. Implementors are called after the list of all subscriptions has been built, and before the distributors are called. Implementors can then remove subscribers from the list, to suppress announcements to them by various criteria.
Interface and central implementation in

The patch contains five exemplary implementations of policers. Some of them have user preferences, all going into a single box in the preferences panel.

To enable the policers, you have to put this in trac.ini:

announcerplugin.policer.* = enabled

Use the admin panel plugin configuration to selectively enable or disable them.

The five policers in the patch provide the following functions, each in a separate policer. All individual trac.ini options go to the [announcer] section:

  • observe WIKI_VIEW or TICKET_VIEW permission, per subscriber. There is no trac.ini option (or user preference :) for this, just enabling or disabling of the policer module.

  • a replacement for the ignore_cc_changes option, previously found in producers/ - both with a backwards compatible trac.ini default, and user preference overriding of that.
    ignore_cc_changes = true

  • a reimplementation of my ignore_status_only patch (#9031), also providing user preferences overriding the trac.ini defaults
    ignore_status_only = true
    no_ignore_status = accepted, super_important_status
  • do not announce changes to the user that the user made herself (by user preference and trac.ini default) This is a replacement for the NeverNotifyUpdaterPlugin, which no longer works when you use AnnouncerPlugin.
    policer.never_notify_updater = true
  • completely disable announcements for the given user (by their preference) Might be useful when people go on holiday. Has no trac.ini default.

User Preference Boxes

While keeping the current preferences box interface, a similar, new extension point IAnnouncementPreferenceSettingProvider can be used to define, from several different implementors, settings that should go into the same box.
Interface in, implementation in

  • two helper functions, user_setting() and get_user_setting(), are provided in for use by any submodule that wants to retrieve or store user preferences. These helpers could be used by several of the existing modules, but this patch does not contain that.
  • A configuration method is provided to sort the boxes in the user preference panel, and to sort the settings in shared boxes as per the new IAnnouncementPreferenceSettingProvider interface.
    pref.order = email, legacy, policer_suppressions, emailaddress
    pref.order.policer_suppressions = never_notify_at_all, never_notify_updater
    If no configuration is made, boxes are sorted alphabetically by their box names. That approach provides a stable order of the boxes, regardless of plugin and extension point order, which seems to be quite shaky.

Changed 6 years ago by Patrick Schaaf

minimal updates

Changed 6 years ago by Patrick Schaaf

respin - now with revert-user-settings-to-defaults functionality

comment:2 Changed 6 years ago by Patrick Schaaf

The -V2 patch moves the user setting helpers from to a new file

Functionality added: when user settings are present in the settings DB, i.e. system defaults from trac.ini are overridden, a new checkbox is rendered at the right margin of the settings box, which can be checked + on submit, the settings in that line will return to their trac.ini defaults, and are removed from the DB.

Calling sites (in policer/*.py) are also cleaned up a bit, with more compact helper function signatures.

The templates use a table now - is there a better way to optionally add a right-floating checkbox that keeps vertical alignment with the settings it stands for?

Changed 6 years ago by Patrick Schaaf

Attachment: policer-settings.png added

teaser - this is how the policer settings box looks like now

comment:3 Changed 4 years ago by Steffen Hoffmann

Owner: changed from Robert Corsaro to Steffen Hoffmann

comment:4 Changed 3 months ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

Modify Ticket

as new The ticket will remain with no owner.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.