from django.shortcuts import render_to_response from django.template import RequestContext from django.conf import settings from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap, BuildPages #from pages.models import PageGenerator 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 == 'builddetails': context = {'message': 'Writing Jrnl Permalinks to Disk'} BuildWriting().build_detail_pages() elif section == 'writingarchives': context = {'message': 'Writing Jrnl Archives to Disk'} BuildWriting().build_writing_archives() BuildWriting().build_country_archive_pages() BuildWriting().build_region_archive_pages() BuildWriting().writing_year_archives() BuildWriting().writing_month_archives() elif section == 'buildrss': context = {'message': 'Writing RSS to Disk'} BuildWritingFeed().build() elif section == 'homepage': context = {'message': 'Writing index to Disk'} BuildWriting().build_homepage() 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)) """ elif section == 'pages': p = PageGenerator(settings.PROJ_ROOT + '_pages') p.write_files() context = {'message': 'Building pages from flatfiles'} """