aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Carlson <thecarlsondaddy@gmail.com>2016-10-04 22:34:43 -0400
committerAndy Carlson <thecarlsondaddy@gmail.com>2016-10-04 22:34:43 -0400
commit71fb83caf68a49b7ea254ac0dbddd98dcc2d0bfa (patch)
tree029f47f394fcd3df64d4912fe97d7bddbdcb4b59
parentac89fa01b56be2bf51ab1007659aaedd595f58de (diff)
fixed main page load
-rw-r--r--ezdb.pycbin0 -> 8811 bytes
-rw-r--r--junos-quicklinks.py29
-rw-r--r--quicklinks.dbbin0 -> 3072 bytes
3 files changed, 17 insertions, 12 deletions
diff --git a/ezdb.pyc b/ezdb.pyc
new file mode 100644
index 0000000..37bcf1d
--- /dev/null
+++ b/ezdb.pyc
Binary files differ
diff --git a/junos-quicklinks.py b/junos-quicklinks.py
index a7d3c66..99dae20 100644
--- a/junos-quicklinks.py
+++ b/junos-quicklinks.py
@@ -1,7 +1,4 @@
-#qpy:webapp:GistClientAndroid
-#qpy://127.0.0.1:8080/
-
-from flask import Flask, render_template, redirect, url_for, request
+from flask import Flask, render_template, redirect, url_for, request, make_response
import sqlite3
from ezdb import DatabaseDef, TableDef
import os
@@ -11,7 +8,12 @@ def GetQuickLinks(db):
return [a for a in db.Select("quicklinks")]
def GetJunosFQDN(db):
- return [a for a in db.Select("settings",["propname"],["fqdn"])][0]['propval']
+ try:
+ returnval = [a for a in db.Select("settings",["propname"],["fqdn"])][0]['propval']
+ except:
+ returnval = ""
+
+ return returnval
def ExistsJunosFQDN(db):
return [a["propval"] for a in db.Select("settings") if a["propname"] == "fqdn"]
@@ -37,16 +39,19 @@ app = Flask(__name__)
@app.route("/")
def GetRoot():
- response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
- response.headers['Pragma'] = 'no-cache'
-
- if not ExistJunosFQDN(linkdb):
- return render_template("fqdn.html")
+ if not ExistsJunosFQDN(linkdb):
+ resp = make_response(render_template("fqdn.html"))
+ resp.headers.set("Cache-Control","no-cache, no-store, must-revalidate")
+ resp.headers.set("Pragma","no-cache")
+ return resp
else:
linklist = GetQuickLinks(linkdb)
domainname = GetJunosFQDN(linkdb)
- return render_template("root.html", domainname = domainname, linklist = linklist)
+ resp = make_response(render_template("root.html", domainname = domainname, linklist = linklist))
+ resp.headers.set("Cache-Control","no-cache, no-store, must-revalidate")
+ resp.headers.set("Pragma","no-cache")
+ return resp
@app.route("/moddomain/", methods = ["POST"])
def ModFqdn():
@@ -55,7 +60,7 @@ def ModFqdn():
if len(domainname) < 1:
return redirect("/?error=invalid-fqdn")
else:
- linkdb.Update("settings",["propval"],[domainname],["propname"],["fqdn"])
+ linkdb.Insert("settings",["fqdn",domainname])
return redirect("/")
@app.route("/resetdomain/", methods = ["POST"])
def ResetDomain():
diff --git a/quicklinks.db b/quicklinks.db
new file mode 100644
index 0000000..f6d2287
--- /dev/null
+++ b/quicklinks.db
Binary files differ