limit max font size
authorTero Marttila <terom@fixme.fi>
Tue, 05 May 2009 17:25:04 +0300
changeset 6 f61000aa264b
parent 5 6d0e03f2fef4
child 7 9a6ac93e7446
limit max font size
index.cgi
--- a/index.cgi	Tue May 05 17:23:40 2009 +0300
+++ b/index.cgi	Tue May 05 17:25:04 2009 +0300
@@ -52,9 +52,11 @@
         'helvetica':            "HELR65W.TTF",
     }
 
+FONT_SIZE_MAX = 1024
 
 # enable debugging
-debug = True
+DEBUG = True
+
 
 def randomize (seq) :
     """
@@ -226,6 +228,9 @@
     background_color = req.args.get('background-color', Defaults.background_color, arg_color)
     line_spacing = req.args.get('line-spacing', Defaults.line_spacing, int)
     sharpness = req.args.get('sharpness', Defaults.sharpness, float)
+
+    if font_size > FONT_SIZE_MAX :
+        raise ValueError(font_size)
     
     # put the chars in random order by default
     if req.args.get('random-chars', True, arg_bool) :
@@ -267,7 +272,7 @@
     handler = wsgiref.handlers.CGIHandler()
     app = wsgi_application
     
-    if debug :
+    if DEBUG :
         # enable debugging
         app = werkzeug.DebuggedApplication(app, evalex=False)