summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-10-29 22:06:33 -0400
committerluxagraf <sng@luxagraf.net>2015-10-29 22:06:33 -0400
commit31d0cad949bf37ad9adf464c6f1553306baafaf6 (patch)
tree0a7fba4f94ecc8cdd6436ec35e6ec811ca2eac59 /app/src
parent9cf6133547c5c36f03c4b3f8f9d80f50d1dea047 (diff)
for got build file, now let's do this thing
Diffstat (limited to 'app/src')
-rw-r--r--app/src/build.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/src/build.py b/app/src/build.py
new file mode 100644
index 0000000..32c8026
--- /dev/null
+++ b/app/src/build.py
@@ -0,0 +1,37 @@
+from builder.base import *
+from django.apps import apps
+
+
+class BuildSrc(Build):
+ def build(self):
+ self.build_archive()
+ self.build_detail_pages()
+
+ def queryset(self):
+ return self.get_model().objects.filter(status__exact).order_by('-date_created')
+
+ def get_model(self):
+ return apps.get_model('src', 'Entry')
+
+ def build_detail_pages(self):
+ '''
+ Grab all the notes, render them to a template string and write that out to the filesystem
+ '''
+ for entry in self.queryset():
+ c = Context({'object': entry, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL, 'SITE_URL':settings.SITE_URL})
+ t = render_to_string('details/src_entry.html', c).encode('utf-8')
+ path = 'src/'
+ self.write_file(path, t, 'html', entry.slug)
+ s = render_to_string('details/note.txt', c).encode('utf-8')
+ self.write_file(path, s, 'txt', entry.slug)
+
+ def build_archive(self):
+ path = 'src/'
+ c = Context({
+ 'object_list': self.queryset(),
+ 'MEDIA_URL': settings.BAKED_MEDIA_URL,
+ 'IMAGES_URL': settings.BAKED_IMAGES_URL
+ })
+ t = render_to_string('archives/src_home.html', c).encode('utf-8')
+ self.write_file(path, t)
+