aboutsummaryrefslogtreecommitdiffstats
path: root/templating/templating.py
diff options
context:
space:
mode:
authorMorten Linderud <morten@linderud.pw>2019-01-22 17:04:47 +0100
committerMorten Linderud <morten@linderud.pw>2019-01-22 17:04:47 +0100
commit115fe3455e6c561723cf3ae0de1856a2dd661d8e (patch)
treeb2a2e11d8ce2fb5df2d825c77d0445544153250a /templating/templating.py
parentd4cd5cfac3c3c4028575114708eb551d25e1933e (diff)
Added python 3.5 compatible string formatting
Diffstat (limited to 'templating/templating.py')
-rwxr-xr-xtemplating/templating.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/templating/templating.py b/templating/templating.py
index 9584fe3..03ad180 100755
--- a/templating/templating.py
+++ b/templating/templating.py
@@ -16,9 +16,9 @@ objects = {}
def getEndpoint(endpoint):
- r = requests.get(f"http://localhost:80/api/{endpoint}")
+ r = requests.get("http://localhost:80/api/{}".format(endpoint))
if r.status_code != 200:
- raise Exception(f"Bad status code for endpoint {endpoint}: {r.status_code}")
+ raise Exception("Bad status code for endpoint {}: {}".format(endpoint, r.status_code))
return r.json()
@@ -56,9 +56,9 @@ def root_get(path):
template = env.get_template(path)
body = template.render(objects=objects, options=request.args)
except TemplateNotFound:
- return f'Template "{path}" not found\n', 404
+ return 'Template "{}" not found\n'.format(path), 404
except Exception as err:
- return f'Templating of "{path}" failed to render. Most likely due to an error in the template. Error transcript:\n\n{err}\n----\n\n{traceback.format_exe()}\n', 400
+ return 'Templating of "{}" failed to render. Most likely due to an error in the template. Error transcript:\n\n{}\n----\n\n{}\n'.format(path, err, traceback.format_exc()), 400
return body, 200
@@ -70,7 +70,7 @@ def root_post(path):
template = env.from_string(content.decode("utf-8"))
body = template.render(objects=objects, options=request.args)
except Exception as err:
- return f'Templating of "{path}" failed to render. Most likely due to an error in the template. Error transcript:\n\n{err}\n----\n\n{traceback.format_exe()}\n', 400
+ return 'Templating of "{}" failed to render. Most likely due to an error in the template. Error transcript:\n\n{}\n----\n\n{}\n'.format(path, err, traceback.format_exc()), 400
return body, 200