Jump to >

reviewboard.accounts.trophies

class TrophyType(title, image_url, image_width=32, image_height=48)[source]

Bases: object

An abstract trophy.

Represents a type of trophy, with logic to see if it qualifies as a trophy for a given review request.

Contains methods to visually display itself.

__init__(title, image_url, image_width=32, image_height=48)[source]

Initialize the trophy.

get_display_text(trophy)[source]

Get the text to display in the trophy banner.

static for_category(category)[source]

Get the TrophyType instance matching a given trophy category.

class MilestoneTrophy[source]

Bases: reviewboard.accounts.trophies.TrophyType

A milestone trophy.

It is awarded if review request ID is greater than 1000 and is a non-zero digit followed by only zeroes (e.g. 1000, 5000, 10000).

category = u’milestone’[source]
__init__()[source]

Initialize the trophy.

get_display_text(trophy)[source]

Get the text to display in the trophy banner.

qualifies(review_request)[source]

Get whether or not the given review request deserves this trophy.

class FishTrophy[source]

Bases: reviewboard.accounts.trophies.TrophyType

A fish trophy.

Give a man a fish, he’ll waste hours trying to figure out why.

category = u’fish’[source]
__init__()[source]

Initialize the trophy.

qualifies(review_request)[source]

Get whether or not the given review request deserves this trophy.

get_display_text(trophy)[source]

Get the text to display in the trophy banner.

class UnknownTrophy[source]

Bases: reviewboard.accounts.trophies.TrophyType

A trophy with an unknown category.

The data for this trophy exists in the database but its category does not match the category of any registered trophy types.

__init__()[source]

Initialize the trophy.

register_trophy(trophy)[source]

Register a TrophyType subclass.

This will register a type of trophy. Review Board will use it to calculate and display possible trophies.

Only TrophyType subclasses are supported.

unregister_trophy(trophy)[source]

Unregister a TrophyType subclass.

This will unregister a previously registered type of trophy.

Only TrophyType subclasses are supported. The class must have been registered beforehand or a ValueError will be thrown.

get_registered_trophy_types()[source]

Get all registered trophy types.