diff options
author | slinderud <simen.linderud@gmail.com> | 2019-12-03 20:23:36 +0100 |
---|---|---|
committer | slinderud <simen.linderud@gmail.com> | 2019-12-03 20:23:36 +0100 |
commit | 920fa648837152255c0937b03ec373c13830da42 (patch) | |
tree | 71dd785d42b9b6a58b760c0ccee8e9c2a2c085cb /web | |
parent | d0f6e569304efd0a98ca6810b5f26e4f0293112b (diff) |
Template: bugfixes on templating.py. Added test template that uses API and created a readme
Diffstat (limited to 'web')
-rw-r--r-- | web/templates/test.conf | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/web/templates/test.conf b/web/templates/test.conf new file mode 100644 index 0000000..ce2fe0d --- /dev/null +++ b/web/templates/test.conf @@ -0,0 +1,17 @@ +{# Fetches something simple from gondul #} +{# Query parameters: ?switch=e1-1 #} + +{# Check if ?switch option is given#} +{% if not options["switch"] %} + {# pretty print public/switches endpoint#} + {{ objects["public/switches"] | pprint }} +{% else %} + {# sets sw variable using the query parameter #} + {% set sw = options["switch"] %} +{% endif %} +{% if sw %} + {# find the correct switch from public/switches api endpoint using query paramter#} + {% set switch = objects["public/switches"].switches[sw] %} + {# pretty print info in api #} + {{ switch | tojson }} +{% endif %} |