diff options
Diffstat (limited to 'app/builder/base.py')
-rw-r--r-- | app/builder/base.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index 7382655..0b92832 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -7,7 +7,7 @@ from django.template import Context from django.db.models import get_model from django.conf import settings -from pages.models import PageGenerator +#from pages.models import PageGenerator class Build(): def write_file(self, path, text_object, ext='html', filename='index'): @@ -57,7 +57,7 @@ class BuildAll(Build): BuildMap().build() BuildWritingFeed().build() BuildSitemap().build() - p = PageGenerator(settings.PROJ_ROOT + '_pages') + BuildPages().build() p.write_files() class BuildWriting(Build): @@ -261,6 +261,17 @@ class BuildWritingFeed(Build): fpath = '%s' % ('rss/',) self.write_file(fpath, t, 'xml') +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}) + 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 BuildMap(Build): def build(self): |