l.t.k.KarmaAssignedEventListener(KarmaRecorder) : class documentation

Part of lp.testing.karma View In Hierarchy

Test helper class that registers a listener printing information whenever Karma is assigned.

No karma assignments will be printed until the register_listener() method is called.

Each time Karma is assigned to a Person, a line in the following format will be printed:

Karma added: action=<action>, [product|distribution]=<contextname>

If show_person is set to True, the name of the person to whom karma is granted will also be shown like this (on one line):

Karma added: action=<action>, [product|distribution]=<contextname>, person=<name>

A set of KarmaAction objects assigned since the register_listener() method was called is available in the added_listener_actions property.

Method __init__ Create a KarmaRecorder, but do not activate it yet.
Method record Overridable: record the assignment of karma.

Inherited from KarmaRecorder:

Method filter Does karma match our filters?
Method receive Process a karma event.
Method register_listener Register listener. Must be `unregister`ed later.
Method unregister_listener Unregister listener after register.
Method _filterFor Does an event property value pass our filter for that property?
def __init__(self, show_person=False):
Create a KarmaRecorder, but do not activate it yet.
ParameterspersonIf given, record only karma for this Person.
action_nameIf given, record only karma with this action name (e.g. questionasked, sponsoruploadaccepted, bugfixed).
productIf given, record only karma related to this Product.
distributionIf given, record only karma related to this Distribution.
sourcepackagenameIf given, record only karma related to this SourcePackageName.
def record(self, karma):
Overridable: record the assignment of karma.

The default action to record the karma object in self.karma_events, but feel free to override this with your own handler.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.