1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
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'}
"""
|