summaryrefslogtreecommitdiff
path: root/app/builder/views.py
blob: ca1296f0452e166e949038826ce53f4e3d10b0f8 (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
75
76
77
78
79
80
81
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.template import RequestContext

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',}    
        """
  
    else:
        context = {}
        #return redirect('/admin/', message='test')
    return render_to_response('admin/message.html', context, context_instance = RequestContext(request))