summaryrefslogtreecommitdiff
path: root/app/builder
diff options
context:
space:
mode:
Diffstat (limited to 'app/builder')
-rw-r--r--app/builder/base.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/builder/base.py b/app/builder/base.py
index a706261..6701cf1 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -302,3 +302,24 @@ class BuildMap(Build):
})
t = render_to_string('archives/map.html', c).encode('utf-8')
self.write_file('', t, "html",'map')
+
+
+# Back up entries to markdown text files which are then stored in dropbox and git
+class EntryBak(Build):
+ def get_model_querset(self):
+ model = get_model('blog', 'entry')
+ qs = model.objects.filter(status__exact=1)
+ return qs
+
+ def write_file(self, path, text_object):
+ file = open(path, 'wb')
+ file.write(text_object)
+ file.close()
+
+ def build_writing_bak(self):
+ qs = self.get_model_querset()
+ for obj in qs:
+ c = Context({'object': obj, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL})
+ path = "%szbak/posts/%s_%s.txt" %(settings.PROJ_ROOT, (obj.pub_date.strftime("%Y-%m-%d").lower()), obj.slug)
+ t = render_to_string('details/entry-bak.txt', c).encode('utf-8')
+ self.write_file(path, t)