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