Create attractive VASL scenarios, with loads of useful information embedded to assist with game play. https://vasl-templates.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
vasl-templates/vasl_templates/webapp/generate.py

26 lines
717 B

""" Webapp handlers. """
import os
from flask import jsonify
from vasl_templates.webapp import app
from vasl_templates.webapp.config.constants import DATA_DIR
# ---------------------------------------------------------------------
@app.route( "/templates" )
def get_templates():
"""Get the specified templates."""
# load the default templates
templates = {}
dname = os.path.join( DATA_DIR, "default-templates" )
for fname in os.listdir(dname):
if os.path.splitext(fname)[1] != ".j2":
continue
fname2 = os.path.join( dname, fname )
with open(fname2,"r") as fp:
templates[os.path.splitext(fname)[0]] = fp.read()
return jsonify( templates )