aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Carlson <ace@ibook-debian>2016-10-05 10:58:30 -0400
committerAndy Carlson <ace@ibook-debian>2016-10-05 10:58:30 -0400
commit3c78a7ca9ffe3a545a6d956321d20d628b43f851 (patch)
tree5b3df55f7b2e811b711b4f84c4e389e7c9569f4c
parent462915097ebb237bcb93030d5b08db8cdc5f19ae (diff)
got delete working
-rw-r--r--ezdb.py9
-rw-r--r--junos-quicklinks.py21
-rw-r--r--templates/root.html8
3 files changed, 25 insertions, 13 deletions
diff --git a/ezdb.py b/ezdb.py
index 985b5e1..eb81f96 100644
--- a/ezdb.py
+++ b/ezdb.py
@@ -194,11 +194,14 @@ class DatabaseDef:
def Delete(self, tablename, fieldlist = None, valuelist = None):
try:
db = self.GetDB()
- returnval = None
if fieldlist and valuelist:
- db.cursor.execute([a for a in self.TABLES if a["name"] == tablename][0]["obj"].Delete(fieldlist,valuelist))
+ db.cursor().execute([a for a in self.TABLES if a["name"] == tablename][0]["obj"].Delete(fieldlist,valuelist))
else:
- db.cursor.execute([a for a in self.TABLES if a["name"] == tablename][0]["obj"].DeleteAll())
+ db.cursor().execute([a for a in self.TABLES if a["name"] == tablename][0]["obj"].DeleteAll())
+
+ db.commit()
+ db.close()
+
except:
return False
diff --git a/junos-quicklinks.py b/junos-quicklinks.py
index 99dae20..3ba9ff7 100644
--- a/junos-quicklinks.py
+++ b/junos-quicklinks.py
@@ -40,18 +40,20 @@ app = Flask(__name__)
@app.route("/")
def GetRoot():
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
+ # 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
+ return render_template("fqdn.html")
else:
linklist = GetQuickLinks(linkdb)
domainname = GetJunosFQDN(linkdb)
- 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
+ # 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
+ return render_template("root.html", domainname = domainname, linklist = linklist)
@app.route("/moddomain/", methods = ["POST"])
def ModFqdn():
@@ -62,9 +64,10 @@ def ModFqdn():
else:
linkdb.Insert("settings",["fqdn",domainname])
return redirect("/")
+
@app.route("/resetdomain/", methods = ["POST"])
def ResetDomain():
- fqdn = str(request.form["domainname"])
+ fqdn = str(request.form["fqdn"])
if len(fqdn) > 0:
linkdb.Delete("settings",["propname"],["fqdn"])
return redirect("/")
diff --git a/templates/root.html b/templates/root.html
index 19e930f..8ea7fe1 100644
--- a/templates/root.html
+++ b/templates/root.html
@@ -11,8 +11,14 @@ URL: <input type="text" name="linkurl" /><br/>
<input type="hidden" name="fqdn" value="{{domainname}}" /><input type="submit" value="Reset FQDN" /><br/><br/>
</form>
<b>Saved Links:</b><br/>
+<table border="0">
{% for thislink in linklist %}
-<a href="https://{{domainname}}/dana/home/launch.cgi?url={{thislink['url']}}" target="_blank">{{thislink['url']}}</a><form method="POST" action="/dellink/"><input type="hidden" name="linkurl" value="{{thislink}}" /><input type="submit" value="Delete" /></form><br/>
+<tr>
+<td><a href="https://{{domainname}}/dana/home/launch.cgi?url={{thislink['url']}}" target="_blank">{{thislink['url']}}</a></td>
+<td style="width:30px;"></td>
+<td><form method="POST" action="/dellink/"><input type="hidden" name="linkurl" value="{{thislink['url']}}" /><input type="submit" value="Delete" /></form></td>
+</tr>
{% endfor %}
+</table>
</body>
</html>