aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django')
-rw-r--r--bn_django/dump_to_pelican.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/bn_django/dump_to_pelican.py b/bn_django/dump_to_pelican.py
new file mode 100644
index 0000000..bc2be28
--- /dev/null
+++ b/bn_django/dump_to_pelican.py
@@ -0,0 +1,41 @@
+
+import os
+from journal.models import *
+from django.contrib.flatpages.models import *
+
+def save_page(p):
+ if p.id == 15: return
+ url = p.url.decode('utf-8')
+ f = open("flat_page_dump/" + url.strip("/").replace("/", "_") + ".html", 'w')
+ f.write("Title: " + p.title + "\n")
+ f.write("Url: " + url + "\n")
+ f.write("SaveAs: " + url + "index.html\n")
+ f.write("Date: " + str(p.date))
+ f.write("\n")
+ f.write("\n")
+ f.write(p.content.decode('utf-8'))
+ f.close()
+
+os.system("mkdir flat_page_dump")
+
+for page in FlatPage.objects.all():
+ save_page(page)
+
+def save_links():
+ f = open("link_dump.html", 'w')
+ f.write("<ul>\n")
+ for l in LinkArtifact.objects.all():
+ f.write("<li><b><a href=\"%s\">%s</a></b> (%s): %s</li>\n" % (
+ l.url, l.title, str(l.date), l.html_caption))
+ f.write("</ul>\n")
+ f.close()
+
+def save_micro():
+ f = open("micro_dump.html", 'w')
+ f.write("<ul>\n")
+ for m in MicroEntry.objects.all():
+ f.write("<li><b>%s</b>: %s\n" % (
+ str(m.date), m.html_content))
+ f.write("</ul>\n")
+ f.close()
+