def get_star_html(cls, resource_id): report = reports.resource_five_stars(resource_id) stars = report.get('openness_score', -1) if stars >= 0: reason = report.get('openness_score_reason') return html.get_star_html(stars, reason) return None
def new_get_star_html(cls, resource_id): report = reports.resource_five_stars(resource_id) stars = report.get('openness_score', -1) reason = p.toolkit._('Not Rated') if stars >= 0: reason = report.get('openness_score_reason') extra_vars = {'stars': stars, 'reason': reason} return p.toolkit.literal(p.toolkit.render('qa/snippets/stars_module.html', extra_vars=extra_vars))