Commits

Luke Plant committed 70fb511

renamed 'writewiki.py' -> 'writers.py'

Comments (0)

Files changed (3)

bibleverses/update.py

 
 from parse import get_verses, get_topic_entries, populate_topic_tree, get_topictree, get_schemes
 from build import build_schemes
-from writewiki import write_page
+from writers import write_page
 from StringIO import StringIO
 
 from config import VERSESPAGENAME, TOPICSPAGENAME, SCHEMESPAGENAME, SCHEMESPAGENAMEPREFIX

bibleverses/writers.py

+#!/usr/bin/env python
+
+from config import DATABASE, AUTHOR
+import time
+import sqlite3
+
+
+def write_page(name, data, add_new_version=False):
+    c = sqlite3.connect(DATABASE)
+    latest_version = c.execute("SELECT MAX(version) FROM wiki WHERE name = ?;", [name]).fetchone()[0]
+    if latest_version is None:
+        c.execute("INSERT INTO wiki (name, version, time, author, ipnr, text, comment, readonly) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
+                  [name, 1, int(time.time()), AUTHOR, '127.0.0.1', data, '', 0])
+    else:
+        if not add_new_version:
+            c.execute("UPDATE wiki SET text = ? WHERE version = ? AND name = ?", [data, latest_version, name])
+        else:
+            raise NotImplementedError("Haven't implemented 'add_new_version=True' yet.")
+    c.commit()
+    c.close()
+    

bibleverses/writewiki.py

-#!/usr/bin/env python
-
-from config import DATABASE, AUTHOR
-import time
-import sqlite3
-
-
-def write_page(name, data, add_new_version=False):
-    c = sqlite3.connect(DATABASE)
-    latest_version = c.execute("SELECT MAX(version) FROM wiki WHERE name = ?;", [name]).fetchone()[0]
-    if latest_version is None:
-        c.execute("INSERT INTO wiki (name, version, time, author, ipnr, text, comment, readonly) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
-                  [name, 1, int(time.time()), AUTHOR, '127.0.0.1', data, '', 0])
-    else:
-        if not add_new_version:
-            c.execute("UPDATE wiki SET text = ? WHERE version = ? AND name = ?", [data, latest_version, name])
-        else:
-            raise NotImplementedError("Haven't implemented 'add_new_version=True' yet.")
-    c.commit()
-    c.close()
-