parent
7a0dd3ebdf
commit
8dc27d90d7
|
@ -259,6 +259,7 @@ class BServer:
|
||||||
result.append("""
|
result.append("""
|
||||||
<p>
|
<p>
|
||||||
<button name="render" value="1" formtarget="_blank">""" + _("Generate") + """</button>
|
<button name="render" value="1" formtarget="_blank">""" + _("Generate") + """</button>
|
||||||
|
<button name="render" value="2" formtarget="_self">""" + _("Download") + """</button>
|
||||||
<button name="render" value="0" formtarget="_self">""" + _("Save to URL") + """</button>
|
<button name="render" value="0" formtarget="_self">""" + _("Save to URL") + """</button>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
@ -472,6 +473,10 @@ class BServer:
|
||||||
name = environ["PATH_INFO"][1:]
|
name = environ["PATH_INFO"][1:]
|
||||||
args = [unquote_plus(arg) for arg in
|
args = [unquote_plus(arg) for arg in
|
||||||
environ.get('QUERY_STRING', '').split("&")]
|
environ.get('QUERY_STRING', '').split("&")]
|
||||||
|
render = "0"
|
||||||
|
for arg in args:
|
||||||
|
if arg.startswith("render="):
|
||||||
|
render = arg[len("render="):]
|
||||||
|
|
||||||
lang = self.getLanguage(args, environ.get("HTTP_ACCEPT_LANGUAGE", ""))
|
lang = self.getLanguage(args, environ.get("HTTP_ACCEPT_LANGUAGE", ""))
|
||||||
_ = lang.gettext
|
_ = lang.gettext
|
||||||
|
@ -486,7 +491,7 @@ class BServer:
|
||||||
else:
|
else:
|
||||||
box = box_cls()
|
box = box_cls()
|
||||||
|
|
||||||
if "render=1" not in args:
|
if render == "0":
|
||||||
defaults = { }
|
defaults = { }
|
||||||
for a in args:
|
for a in args:
|
||||||
kv = a.split('=')
|
kv = a.split('=')
|
||||||
|
@ -496,7 +501,7 @@ class BServer:
|
||||||
start_response(status, headers)
|
start_response(status, headers)
|
||||||
return self.args2html(name, box, lang, "./" + name, defaults=defaults)
|
return self.args2html(name, box, lang, "./" + name, defaults=defaults)
|
||||||
else:
|
else:
|
||||||
args = ["--"+ arg for arg in args if arg != "render=1"]
|
args = ["--"+ arg for arg in args if not arg.startswith("render=")]
|
||||||
try:
|
try:
|
||||||
box.parseArgs(args)
|
box.parseArgs(args)
|
||||||
except (ArgumentParserError) as e:
|
except (ArgumentParserError) as e:
|
||||||
|
@ -534,7 +539,7 @@ class BServer:
|
||||||
box.format,
|
box.format,
|
||||||
[('Content-type', 'application/unknown; charset=utf-8')])[:]
|
[('Content-type', 'application/unknown; charset=utf-8')])[:]
|
||||||
|
|
||||||
if box.format != "svg":
|
if box.format != "svg" or render == "2":
|
||||||
extension = box.format
|
extension = box.format
|
||||||
if extension == "svg_Ponoko":
|
if extension == "svg_Ponoko":
|
||||||
extension = "svg"
|
extension = "svg"
|
||||||
|
|
Loading…
Reference in New Issue