summaryrefslogtreecommitdiff
path: root/app/builder/views.py
blob: 1875a91daa37f07d6d603996d415baca053db90a (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from django.shortcuts import render_to_response
from django.template import RequestContext
from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap
from src.build import builder as src_builder
from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, amp_builder
from resume.build import builder as resume_builder
from books.build import builder as book_builder
from birds.build import builder as bird_builder
from photos.build import builder as photo_builder
from figments.build import builder as figments_builder
from notes.build import builder as notes_builder
from pages.build import builder as page_builder

options = {
    'writing': BuildWriting,
    'photo_galleries': BuildPhotos,
    'projects': BuildProjects,
    'map': BuildMap,
    'feed': BuildWritingFeed,
    'sitemap': BuildSitemap,
}


def do_build(request):
    section = request.GET.get('id', '')
    context = {}
    if section == 'builddetails':
        context = {'message': 'Writing Jrnl Permalinks to Disk'}
        detail_builder()
    elif section == 'writingarchives':
        context = {'message': 'Writing Jrnl Archives to Disk'}
        archive_builder()
    elif section == 'resume':
        context = {'message': 'Writing Resume to Disk'}
        resume_builder()
    elif section == 'buildrss':
        context = {'message': 'Writing RSS to Disk'}
        rss_builder()
    elif section == 'homepage':
        context = {'message': 'Writing index to Disk'}
        home_builder()
    elif section == 'buildbooks':
        context = {'message': 'Writing Book Pages to Disk'}
        book_builder()
    elif section == 'buildbirds':
        context = {'message': 'Writing Bird Pages to Disk'}
        bird_builder()
    elif section == 'src':
        context = {'message': 'Writing src section to Disk'}
        src_builder()
    elif section == 'luxphotos':
        context = {'message': 'Writing galleries to Disk'}
        photo_builder()
    elif section == 'figments':
        context = {'message': 'Writing figments to Disk'}
        figments_builder()
    elif section == 'notes':
        context = {'message': 'Writing notes to Disk'}
        notes_builder()
    elif section == 'pages':
        context = {'message': 'Writing Pages to Disk'}
        page_builder()
    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'}
"""