diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index 355871217..58e1c2e21 100644 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -251,11 +251,11 @@ def style_line(button_width = None, bgcolor = "", bordercolor = ""): style_line += "width: %spx;" % button_width return style_line -def choose_width(thing, width): +def choose_width(link, width): if width: return width - 5 else: - if thing: - return 100 + (10 * (len(str(thing.link.score)))) + if link: + return 100 + (10 * (len(str(link._ups - link._downs)))) else: return 110 diff --git a/r2/r2/templates/buttontypes.html b/r2/r2/templates/buttontypes.html index 8b9c07e9f..92d4273fa 100644 --- a/r2/r2/templates/buttontypes.html +++ b/r2/r2/templates/buttontypes.html @@ -42,7 +42,7 @@ <%def name="button1(thing)"> -${class_def(1, width=choose_width(thing, thing.width))} +${class_def(1, width=choose_width(thing.link, thing.width))}