+#!/usr/bin/python3
+
import bottle
import validators
import html
def atomic_write(path, content, mode):
"""Atomic write/append to file."""
_, tmpPath = tempfile.mkstemp()
- if 'a' == mode:
+ if 'a' == mode and os.path.exists(path):
shutil.copy2(path, tmpPath)
f = open(tmpPath, mode)
f.write(content)