From a903a8dfcf7295465f6630f290e22e974c4b48f7 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 21 May 2016 20:31:04 +0200 Subject: [PATCH] Use GET instead of POST for rendering the SVGs This allows saving or editing the links to the to be rendered SVGs --- scripts/boxesserver | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/boxesserver b/scripts/boxesserver index 556815f..844d07f 100755 --- a/scripts/boxesserver +++ b/scripts/boxesserver @@ -77,7 +77,7 @@ class BServer:

""", name, """

""", box.__doc__, """

-
+ """ % (action)] for a in box.argparser._actions: @@ -87,7 +87,7 @@ class BServer: if a.dest == "burn": result.append("
\n
\n\n") result.append("""
-

+

@@ -151,16 +151,12 @@ flex cuts, holes and slots for screws and more high level functions. start_response(status, headers) return self.menu() - if environ["REQUEST_METHOD"] == "GET": + args = ["--"+arg for arg in environ['QUERY_STRING'].split("&")] + if "--render=1" not in args: start_response(status, headers) return self.args2html(name, box) - elif environ["REQUEST_METHOD"] == "POST": - try: - length = int(environ.get('CONTENT_LENGTH', '0')) - except ValueError: - length = 0 - body = environ['wsgi.input'].read(length).decode() - args = ["--"+arg for arg in body.split("&")] + else: + args = [a for a in args if a != "--render=1"] try: box.parseArgs(args) except (ArgumentParserError) as e: