aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/docs.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/docs.py')
-rw-r--r--wqflask/wqflask/docs.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py
index 9777f170..0187f32e 100644
--- a/wqflask/wqflask/docs.py
+++ b/wqflask/wqflask/docs.py
@@ -7,7 +7,7 @@ logger = getLogger(__name__)
class Docs(object):
- def __init__(self, entry):
+ def __init__(self, entry, start_vars={}):
sql = """
SELECT Docs.title, Docs.content
FROM Docs
@@ -15,13 +15,29 @@ class Docs(object):
"""
result = g.db.execute(sql, str(entry)).fetchone()
self.entry = entry
- self.title = result[0]
- self.content = result[1]
+ if result == None:
+ self.title = self.entry.capitalize()
+ self.content = ""
+ else:
+ self.title = result[0]
+ self.content = result[1]
+
+ self.editable = "false"
+ # ZS: Removing option to edit to see if text still gets vandalized
+ try:
+ if g.user_session.record['user_email_address'] == "zachary.a.sloan@gmail.com" or g.user_session.record['user_email_address'] == "labwilliams@gmail.com":
+ self.editable = "true"
+ except:
+ pass
+
def update_text(start_vars):
content = start_vars['ckcontent']
content = content.replace('%', '%%').replace('"', '\\"').replace("'", "\\'")
- sql = "UPDATE Docs SET content='{0}' WHERE entry='{1}';".format(content, start_vars['entry_type'])
-
- g.db.execute(sql) \ No newline at end of file
+ try:
+ if g.user_session.record['user_email_address'] == "zachary.a.sloan@gmail.com" or g.user_session.record['user_email_address'] == "labwilliams@gmail.com":
+ sql = "UPDATE Docs SET content='{0}' WHERE entry='{1}';".format(content, start_vars['entry_type'])
+ g.db.execute(sql)
+ except:
+ pass \ No newline at end of file