#! /usr/bin/env python
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2020 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2020, 2021 PhiloSoft Design"
import os
from blog_db import blog_root, load_blog
if current_mtime is not None and (next_mtime < current_mtime):
os.remove(next_html)
-current_tmpl = fullpath(key, blog_post)
-try:
- current_mtime = os.path.getmtime(current_tmpl)
-except OSError:
- pass
-else:
- current_mtime = None
+if blog:
+ current_tmpl = fullpath(key, blog_post)
+ try:
+ current_mtime = os.path.getmtime(current_tmpl)
+ except OSError:
+ pass
+ else:
+ current_mtime = None
-prev_html = html(fullpath(current_key, current_blog_post))
-try:
- prev_mtime = os.path.getmtime(prev_html)
-except OSError:
- pass
-else:
- if current_mtime is not None and (prev_mtime < current_mtime):
- os.remove(prev_html)
+ prev_html = html(fullpath(current_key, current_blog_post))
+ try:
+ prev_mtime = os.path.getmtime(prev_html)
+ except OSError:
+ pass
+ else:
+ if current_mtime is not None and (prev_mtime < current_mtime):
+ os.remove(prev_html)