diff options
author | luxagraf <sng@luxagraf.net> | 2014-05-23 11:28:10 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2014-05-23 11:28:10 -0400 |
commit | 518b2d618bc10f93cfa44a83715593b8358eb9ce (patch) | |
tree | a07993c3ae31bed42f32c0e00788989568790716 /app/builder/views.py | |
parent | 4bae11bb25a8e3c43118891d17fd8e981ecf8dc6 (diff) |
minor refactor to adoipt pep8 and pyflakes coding styles and clean up
some cruft that's been hangin round for years
Diffstat (limited to 'app/builder/views.py')
-rw-r--r-- | app/builder/views.py | 101 |
1 files changed, 26 insertions, 75 deletions
diff --git a/app/builder/views.py b/app/builder/views.py index ca1296f..c0b8125 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -1,81 +1,32 @@ -from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse -from django.shortcuts import render_to_response,get_object_or_404,redirect - +from django.shortcuts import render_to_response from django.template import RequestContext +from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPages, BuildPhotos, BuildProjects, BuildSitemap, BuildContact + +options = { + 'writing': BuildWriting, + 'photo_galleries': BuildPhotos, + 'projects': BuildProjects, + 'pages': BuildPages, + 'map': BuildMap, + 'feed': BuildWritingFeed, + 'sitemap': BuildSitemap, +} -from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPages, BuildPhotos,BuildProjects,BuildSitemap,BuildContact def do_build(request): section = request.GET.get('id', '') - if section != '': - - #build writing archives - if section == 'writing': - BuildWriting().build() - context = {'message': 'Writing Posts to Disk',} - - #build photo galleries - elif section == 'photos': - BuildPhotos().build() - context = {'message': 'Writing Photo Galleries to Disk',} - - #build project pages - elif section == 'projects': - BuildProjects().build() - context = {'message': 'Writing Project pages to Disk',} - - #build pages - elif section == 'pages': - BuildPages().build() - context = {'message': 'Writing Pages to Disk',} - - #build map - elif section == 'map': - BuildMap().build() - context = {'message': 'Writing Map to Disk',} - - #build Writing RSS Feed - elif section == 'feed': - BuildWritingFeed().build() - context = {'message': 'Writing RSS Feed to Disk',} - - #build Sitemap - elif section == 'sitemap': - BuildSitemap().build() - context = {'message': 'Writing Sitemap to Disk',} - - #build Everything need for new post - elif section == 'newpost': - #build writing archives/details pages/homepage - BuildWriting().build() - #build map - BuildMap().build() - #build feed - BuildWritingFeed().build() - #build sitemap - BuildSitemap().build() - context = {'message': 'Publishing New Post',} - - #build Homepage - elif section == 'home': - BuildWriting().build_homepage() - context = {'message': 'Writing Homepage to Disk',} - #Crawl Flickr for new Photosets - elif section == 'scrapeflickr': - from photos import retriever - retriever.sync_sets() - context = {'message': 'Crawling Flickr for new photosets',} - """ - elif section == 'all': - g.build_entire_site() - context = {'message': 'Writing Entire Site to disk',} - """ - + context = {} + if section == 'newpost': + BuildWriting().build() + BuildMap().build() + BuildWritingFeed().build() + BuildSitemap().build() + context = {'message': 'Writing %s to Disk' % section} + elif section == 'scrapeflickr': + from photos import retriever + retriever.sync_sets() + context = {'message': 'Crawling Flickr for new photosets'} else: - context = {} - #return redirect('/admin/', message='test') - return render_to_response('admin/message.html', context, context_instance = RequestContext(request)) - - - + options[section]().build() + context = {'message': 'Writing %s to Disk' % section} + return render_to_response('admin/message.html', context, context_instance=RequestContext(request)) |