--- fract/mandelzoom.cgi 2001/02/26 11:26:15 1.8 +++ fract/mandelzoom.cgi 2001/06/19 22:27:27 1.9 @@ -1,8 +1,14 @@ #!/usr/bin/python -import cgi, Image, ImageDraw, sys, math +import cgi, Image, ImageDraw, sys, math, signal, errno, os from string import atoi, atof +def handler(signum, frame): + raise os.error, (errno.ETIME, "Timer expired") + +signal.alarm(55) +signal.signal(signal.SIGALRM, handler) + # This is to get backtrace output sys.stderr = sys.stdout @@ -249,7 +255,13 @@ else: yto= yorig # End at x axis -drawrect((0, yfrom), (xmax, yto)) +try: + drawrect((0, yfrom), (xmax, yto)) +except os.error, the_error: + if the_error[0] != errno.ETIME: + raise os.error, the_error + +signal.alarm(0) print "Content-type: image/png" print