From 71cb72d7f922aebd2c1dab11884dfa5c28bf4aef Mon Sep 17 00:00:00 2001 From: Colin Davis Date: Fri, 8 Jul 2011 02:17:37 -0400 Subject: [PATCH] jpg bug --- templates/root.html | 19 ++++++------------- webfront.py | 7 ++++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/templates/root.html b/templates/root.html index e0d7cda..6b83a71 100644 --- a/templates/root.html +++ b/templates/root.html @@ -201,19 +201,17 @@ $(document).ready(function(){
+{% set drquotes = ['"Eliminates sources of Human Error."
Dr. Chandra, RobotCrunch',' "Klaatu barada nikto!"
Gort\'s Web Emporium','"A huge success!."
Cave Johnson, CEO, Aperture Laboratories','"Finally, a place to get speedy and heroic robots; I can retire in peace."
Thomas Light','"The Ultimate Worker."
Joh Fredersen, Founder Metropolis','"They almost look alive."
N. Crosby, Nova Robotics ','"It looks highly Profitable, I\'m Sure."
Dr. R. Venture, Super Scientist','"To make any alteration would prove fatal."
Dr. Eldon Tyrell', '"The robots are all so.. Normal!"
Joanna Eberhart, Beta tester','"They have great dreams, and potential. May they never reach them.."
Dr. N. Soong'] %} + + + 1 star1 star1 star1 star1 star -
- -"Eliminates sources of Human Error." - -
- -Dr. Chandra, RobotCrunch +{{ drquotes[random.randrange(0, len(drquotes)/2) ] }}
@@ -227,12 +225,7 @@ src="http://static1.robohash.com/static/img/indented_star.png" width="27" height src="http://static1.robohash.com/static/img/indented_star.png" width="27" height="25" alt="1 star" />
- -"Klaatu barada nikto!" - -
- -Gort's Web Emporium +{{drquotes[ random.randrange( len(drquotes)/2,len(drquotes) )] }} diff --git a/webfront.py b/webfront.py index f66974f..9f1aa9b 100755 --- a/webfront.py +++ b/webfront.py @@ -148,10 +148,11 @@ class ImgHandler(tornado.web.RequestHandler): #Change to a usuable format - if string.endswith(('.png','.gif','.jpg','bmp','im','jpeg','pcx','ppm','tiff','xbm')): + if string.endswith(('.png','.gif','.jpg','.bmp','.im','.jpeg','.pcx','.ppm','.tiff','.xbm')): ext = string[string.rfind('.') +1 :len(string)] - if ext == '.jpg': - ext = '.jpeg' + if ext.lower() == 'jpg': + print "-------" + ext = 'jpeg' else: ext = "png" self.set_header("Content-Type", "image/" + ext)