diff options
Diffstat (limited to 'wqflask/wqflask/docs.py')
-rw-r--r-- | wqflask/wqflask/docs.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 9777f170..f45202af 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,8 +15,17 @@ 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] + + if 'edit' in start_vars and start_vars['edit'] == "true": + self.editable = "true" + else: + self.editable = "false" def update_text(start_vars): content = start_vars['ckcontent'] |