def maze(request, size): ''' creates a maze. accepts a 'size' param on the querysting Generates an image that is sent as the whole reponse Should experiment with displaying a html page within which an image is displayed, the source of which is this ''' try: size = int(size) if size > 30: size = 30 m = Maze(size, size) image = m.as_image() response = HttpResponse(mimetype="image/png") image.save(response, "PNG") return response except: pass