diff options
Diffstat (limited to 'app/builder')
-rw-r--r-- | app/builder/base.py | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index 7f6f434..7c85ad9 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -7,6 +7,7 @@ from django.template import Context from django.db.models import get_model from django.conf import settings +from pages.models import PageGenerator class Build(): def write_file(self, path, text_object, ext='html', filename='index'): @@ -48,6 +49,16 @@ class Build(): self.write_file(base_path, response.content) self.write_file(path, response.content) +class BuildAll(Build): + def build(self): + BuildWriting().build() + BuildPhotos().build() + BuildProjects().build() + BuildMap().build() + BuildWritingFeed().build() + BuildSitemap().build() + p = PageGenerator(settings.PROJ_ROOT + '_pages') + p.write_files() class BuildWriting(Build): def build(self): @@ -278,29 +289,3 @@ class BuildMap(Build): }) t = render_to_string('archives/map.html', c).encode('utf-8') self.write_file('map', t) - - -class BuildPages(Build): - def build(self): - model = get_model('pages', 'page') - pages = model.objects.all() - for page in pages: - c = Context({'object': page, 'SITE_URL': settings.SITE_URL, 'MEDIA_URL': - settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL}) - t = render_to_string( - ["details/%s.html" % page.slug, 'details/page.html'], c).encode('utf-8') - s = render_to_string('details/page.txt', c).encode('utf-8') - fpath = '%s/' % (page.slug) - self.write_file(fpath, t) - self.write_file(fpath, s, 'txt') - - -class BuildContact(Build): - def build(self): - c = Client() - response = c.get('/contact/', HTTP_HOST = '127.0.0.1') - path = '%scontact/' % (settings.BAKED_ROOT) - if not os.path.isdir(path): - os.makedirs(path) - fpath = '%sindex.html' % (path) - self.write_file(fpath, response.content) |