From 5f12708dde05c6d6fc4cc089c6c93b67120b8f38 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 21 Oct 2012 22:05:26 -0400 Subject: fixed two bugs, gif projs now get built and the archive list views for writing and photos check to see if the request is from the django client and adjust MEDIA_URL accordingly --- app/builder/base.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'app/builder') diff --git a/app/builder/base.py b/app/builder/base.py index 7d57c5e..a112aa0 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -44,7 +44,7 @@ class Build(): path = '%s%s/' %(base_path, page+1) url = '/%s%s/' %(base_path, str(page+1)) page_url = base_path+'%d/' - response = c.post(url, {'page_url': page_url, 'page': int(page), 'MEDIA_URL':settings.BAKED_MEDIA_URL}) + response = c.post(url, {'page_url': page_url, 'page': int(page), 'builder':True }) if page == 0: self.write_file(base_path,str(response.content)) self.write_file(path,str(response.content)) @@ -128,8 +128,7 @@ class BuildPhotos(Build): def build_photo_archive_pages(self): qs = get_model('photos', 'PhotoGallery').objects.all() - path = 'photos/' - self.build_archive_pages(qs, path, 18) + self.build_archive_pages(qs, 'photos/', 18) def build_detail_pages(self): qs = get_model('photos', 'PhotoGallery').objects.all() @@ -144,7 +143,8 @@ class BuildProjects(Build): self.build_project_archive() self.build_project_details() self.build_project_data() - + self.build_gifs() + def get_projects(self): all_proj = [] projects = get_model('projects', 'Project').objects.filter(status__exact=1).order_by('-pub_date') @@ -171,6 +171,22 @@ class BuildProjects(Build): t = render_to_string('details/%s.html' %(proj['slug']), c).encode('utf-8') path = 'projects/%s/' %(proj['slug']) self.write_file(path,t) + + """ + not sure how to handle projects really, the above doesn't work and + if I just keep writing if/else statements that gets messy, so I guess + functions it is. + """ + def build_gifs(self): + qs = get_model('projects', 'AnimatedGif').objects.all() + for gif in qs: + c = Context({'object':gif,'MEDIA_URL':settings.BAKED_MEDIA_URL, 'IMAGES_URL':settings.BAKED_IMAGES_URL}) + t = render_to_string('details/gifs.html',c).encode('utf-8') + path = 'projects/gifs/%s/' %(gif.slug) + self.write_file(path,t) + + + def build_project_data(self): from projects.shortcuts import render_to_geojson -- cgit v1.2.3-70-g09d2