Partially implemented template editor
[biaweb_qt.git] / biaweb_db.py
index 80e3915..c2761f5 100644 (file)
@@ -6,6 +6,20 @@ import os
 import os.path
 import time
 
+# function to get the template text for a particular template
+def get_template_text (dbname, template_name):
+       try:
+               conn = sqlite3.connect (dbname)
+               c = conn.cursor ()
+               c.execute ("SELECT template_content FROM templates WHERE template_name=?",
+                                               (template_name,))
+               conn.commit ()
+               row = c.fetchone ()
+               conn.close ()
+               return row[0]
+       except sqlite3.Error:
+               return False
+
 # function to retrieve the templates from the database
 def get_templates (dbname):
        try: