diff options
Diffstat (limited to 'wqflask/wqflask/docs.py')
-rw-r--r-- | wqflask/wqflask/docs.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 0187f32e..0a1a597d 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -1,15 +1,16 @@ -from __future__ import absolute_import, print_function, division +import codecs from flask import g from utility.logger import getLogger logger = getLogger(__name__) -class Docs(object): + +class Docs: def __init__(self, entry, start_vars={}): sql = """ - SELECT Docs.title, Docs.content + SELECT Docs.title, CAST(Docs.content AS BINARY) FROM Docs WHERE Docs.entry LIKE %s """ @@ -19,8 +20,9 @@ class Docs(object): self.title = self.entry.capitalize() self.content = "" else: + self.title = result[0] - self.content = result[1] + self.content = result[1].decode("utf-8") self.editable = "false" # ZS: Removing option to edit to see if text still gets vandalized @@ -33,11 +35,13 @@ class Docs(object): def update_text(start_vars): content = start_vars['ckcontent'] - content = content.replace('%', '%%').replace('"', '\\"').replace("'", "\\'") + content = content.replace('%', '%%').replace( + '"', '\\"').replace("'", "\\'") 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']) + 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 + pass |