Only check time if it exists

This commit is contained in:
Tom Willemsen 2011-11-05 02:23:26 +01:00
parent f426a2f8ef
commit 186d47fe84

View file

@ -18,9 +18,9 @@ class Command(BaseCommand):
htmlpath = '%s/templates/html_pages/%s' % (DEPLOY_PATH, mdname) htmlpath = '%s/templates/html_pages/%s' % (DEPLOY_PATH, mdname)
htmlfile = '%s/index.html' % htmlpath htmlfile = '%s/index.html' % htmlpath
if mdtuple[1] == '.mdwn' \ if mdtuple[1] == '.mdwn' and os.path.exists(mdfile) \
and os.path.exists(mdfile) and not os.path.exists(htmlfile) \ and (not os.path.exists(htmlfile) \
or os.path.getmtime(mdfile) > os.path.getmtime(htmlfile): or os.path.getmtime(mdfile) > os.path.getmtime(htmlfile)):
if not os.path.exists(htmlpath): if not os.path.exists(htmlpath):
os.makedirs(htmlpath) os.makedirs(htmlpath)
@ -28,8 +28,7 @@ class Command(BaseCommand):
md = markdown.Markdown() md = markdown.Markdown()
print 'Converting ', mdname, '-->', htmlfile, print 'Converting ', mdname, '-->', htmlfile,
wikiExtension = 'wikilinks(base_url=%s/)' % subdir wikiExtension = 'wikilinks(base_url=%s/)' % subdir
markdown.markdownFromFile(input=mdfile, output=htmlfile, markdown.markdownFromFile(input=mdfile, output=htmlfile, encoding="utf-8",
encoding="utf-8",
extensions=[wikiExtension]) extensions=[wikiExtension])
print ' ... succeeded' print ' ... succeeded'