pubish_projects now updates changed projects
authorDylan Lloyd <dylan@dylansserver.com>
Tue, 13 Mar 2012 19:52:05 +0000 (15:52 -0400)
committerDylan Lloyd <dylan@dylansserver.com>
Tue, 13 Mar 2012 19:52:05 +0000 (15:52 -0400)
publish_projects

index 734d485..f1c7f8e 100755 (executable)
@@ -28,7 +28,10 @@ for note in notes:
     if (note[:1] == '.'): continue
     title = note[:note.index('.html')]
     f = open(os.path.join(PROJECTS_DIRECTORY, note))
-    if title in existing_titles: continue
     text = f.read()
-    cursor.execute("INSERT INTO projects (title, text)\
+    if title in existing_titles:
+        cursor.execute("UPDATE projects SET text=%s \
+                            WHERE title=%s", (text, title))
+    else:
+        cursor.execute("INSERT INTO projects (title, text) \
                         VALUES (%s, %s)", (title, text))