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, } def do_build(request): section = request.GET.get('id', '') 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: options[section]().build() context = {'message': 'Writing %s to Disk' % section} return render_to_response('admin/message.html', context, context_instance=RequestContext(request))