tahrir.utils.badge module

tahrir.utils.badge.badge_json_generator(badge, withasserts=True)[source]

Serialize a badge for the JSON API.

When withasserts is False, returns compact data for listings.

tahrir.utils.badge.convert_name_to_id(name)[source]

Convert a badge name into a valid badge ID.

Parameters:

name (string) – The badge name to convert to an ID

tahrir.utils.badge.generate_badge_yaml(postdict)[source]
tahrir.utils.badge.get_badge_or_404(badge_id)[source]
tahrir.utils.badge.organize_badges_by_tags(serialized_badges)[source]

Helper function to organize badges by tags using indices.

tahrir.utils.badge.serialize_badges(badges)[source]

Helper function to serialize badge objects to dictionaries.

tahrir.utils.badge.sort_badges_by_tag(badges)[source]