make the button backwards compatible for deployment

This commit is contained in:
Jeremy Edberg
2008-10-14 10:52:43 -07:00
parent 000feb8583
commit f373061205
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -42,7 +42,7 @@
</%def>
<%def name="button1(thing)">
${class_def(1, width=choose_width(thing, thing.width))}
${class_def(1, width=choose_width(thing.link, thing.width))}
<div class="headimgcell">
<a href="${submiturl(thing.url, thing.title)}" target="${thing.target}">
<img src="http://www.reddit.com/static/blog_head.png" alt=""/>