Skip to content

Instantly share code, notes, and snippets.

@sheki
Created December 2, 2011 07:06
Show Gist options
  • Select an option

  • Save sheki/1422153 to your computer and use it in GitHub Desktop.

Select an option

Save sheki/1422153 to your computer and use it in GitHub Desktop.
Flask APplication.
@app.route('/tag/<tag>')
def show_tag(tag):
q = Query(CONFIG_ROOT)
tag_config = q.tag_config(tag, as_yaml=True)
hosts = q.hosts_by_tag(tag)
details = [(h, url_for('show_host', host=h)) for h in hosts]
return render_template("item.html", conf=tag_config, details=details)
@app.route('/api/alltags')
def api_all_tags():
Response.default_mimetype = "text/plain"
tags = Query(CONFIG_ROOT).all_tags()
return '\n'.join(tags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment