import cherrypy from jinja2 import Environment, FileSystemLoader env = Environment(loader=FileSystemLoader('templates')) class Wayf(object): @cherrypy.expose def index(self,token=None): if token is None: tmpl = env.get_template('error.html') return tmpl.render(message="Sorry you need a token to access this page") else: tmpl = env.get_template('wayf.html') return tmpl.render(token=token)