bootbox/app/views.py
2019-11-19 07:14:45 -05:00

38 lines
810 B
Python

import os
import pprint
import re
##
from flask import render_template, make_response, request, Response
from flask_autoindex import AutoIndex
##
from app import db
from app import app
ua_re = re.compile(r'^iPXE/v[0-9.]+')
# TODO: NBI support? https://github.com/bruienne/bsdpy
# http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2010q1/003638.html
def getReqInfo():
d = {}
for a in dir(request):
if a.startswith('_'):
continue
d[a] = getattr(request, a)
return(d)
@app.route('/', methods = ['GET'])
def index():
DB = db.LocalDB()
result = render_template('main.ipxe.j2',
db = DB)
DB.close()
return(result)
@app.route('/foo', methods = ['GET'])
def foo():
pprint.pprint(getReqInfo())
return(Response())