def generate(self, dst): settings.SERVER_NAME = "example.com" # Doesn't matter... settings.WEB_ROOT = dst settings.BASE = self.BASE settings.WWWROOT = self.WWWROOT if self.EXT_BASE: settings.EXT_BASE = self.EXT_BASE elif ':' in self.BASE: settings.EXT_BASE = self.BASE else: settings.EXT_BASE = 'http:' + self.BASE settings.PHP = False settings.PHP_INCLUDE = self.PHP_INCLUDE resources = [ Entry.all_entries, Article, Tag, '/blog/index.html', '/blog/tags.html', '/blog/tag/none.html', '/blog/rss.xml', '/blog/planetpython.xml', '/blog/archive/all.html', '/blog/moved.php', '/blog/drafts.html', '/0inc/sidebar_blog.inc', '/0inc/sidebar_page.inc', '/0inc/navbar.inc', '/0inc/metatags.inc', '/index.html', ] resources += [ '/blog/archive/year%4d.html' % d.year for d in Entry.objects.dates('when', 'year') ] dates = [] date = datetime.datetime(2004, 1, 1) # Use a leap year while date.year == 2004: dates.append((date.month, date.day)) date += datetime.timedelta(days=1) resources += [ '/blog/archive/date%02d%02d.html' % date for date in dates ] generator.quick_publish(resources, use_processes=self.use_processes) # Build the JS file as the concatenation of others. with open("js/ingredients.txt") as ingredients: js = ingredients.read().split() with open(dst + "/nedbatchelder.js", "w") as outjs: for f in js: with open("js/" + f) as jsin: outjs.write(jsin.read()) outjs.write("\n")
def generate(self, dst): settings.SERVER_NAME = "example.com" # Doesn't matter... settings.WEB_ROOT = dst settings.BASE = self.BASE settings.WWWROOT = self.WWWROOT if self.EXT_BASE: settings.EXT_BASE = self.EXT_BASE elif ':' in self.BASE: settings.EXT_BASE = self.BASE else: settings.EXT_BASE = 'http:' + self.BASE settings.PHP = False settings.PHP_INCLUDE = self.PHP_INCLUDE resources = [ Entry.all_entries, Article, Tag, '/blog/index.html', '/blog/tags.html', '/blog/tag/none.html', '/blog/rss.xml', '/blog/planetpython.xml', '/blog/archive/all.html', '/blog/moved.php', '/blog/drafts.html', '/sidebar_blog.inc', '/sidebar_page.inc', '/index.html', ] resources += ['/blog/archive/year%4d.html' % d.year for d in Entry.objects.dates('when', 'year')] dates = [] date = datetime.datetime(2004, 1, 1) # Use a leap year while date.year == 2004: dates.append((date.month, date.day)) date += datetime.timedelta(days=1) resources += ['/blog/archive/date%02d%02d.html' % date for date in dates] generator.quick_publish(resources, use_processes=self.use_processes) # Build the JS file as the concatenation of others. with open("js/ingredients.txt") as ingredients: js = ingredients.read().split() with open(dst+"/nedbatchelder.js", "w") as outjs: for f in js: with open("js/"+f) as jsin: outjs.write(jsin.read()) outjs.write("\n")
def generate(self, baseurl, dst): settings.SERVER_NAME = "example.com" # Doesn't matter... settings.WEB_ROOT = dst settings.BASE = baseurl settings.PHP = False settings.PHP_INCLUDE = True resources = [ Entry.objects, Article, Tag, '/blog/index.html', '/blog/tags.html', '/blog/tag/none.html', '/blog/rss.xml', '/blog/planetpython.xml', '/blog/archiveall.html', '/blog/moved.php', '/sidebar_blog.inc', '/sidebar_page.inc', '/tabblo_badge_favs.html', '/tabblo_badge_recent.html', '/index.html', ] months = set(e.monthurl() for e in Entry.objects.all()) resources += list(months) years = [ '/blog/archive%4d.html' % d.year for d in Entry.objects.dates('when', 'year') ] resources += years generator.quick_publish(resources, use_processes=self.use_processes) # Build the JS file as the concatenation of others. js = file("js/ingredients.txt").read().split() outjs = file(dst+"/nedbatchelder.js", "w") for f in js: outjs.write(file("js/"+f).read()) outjs.write("\n") outjs.close()
def render_for_project(sender, instance, signal, *args, **kwargs): quick_publish((instance, '/projects'))
def render_for_comment(sender, instance, signal, *args, **kwargs): quick_publish((instance.entry, '/'))
def render_for_entry(sender, instance, signal, *args, **kwargs): # note: not yet re-rendering previous and next entries quick_publish((instance, '/', '/articles/', '/tags/'))