basic dynamic menu generation
This commit is contained in:
35
app/views.py
35
app/views.py
@@ -0,0 +1,35 @@
|
||||
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.]+')
|
||||
|
||||
|
||||
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())
|
||||
|
||||
Reference in New Issue
Block a user