Escape backslashes in PEPs when writing an index.yml

This commit is contained in:
Andrew M. Kuchling 2007-04-20 20:55:15 +00:00
parent d54e5eac4a
commit 69064d13b6
1 changed files with 1 additions and 0 deletions

View File

@ -428,6 +428,7 @@ def set_up_pyramid(inpath):
def write_pyramid_index(destDir, title): def write_pyramid_index(destDir, title):
filename = os.path.join(destDir, 'index.yml') filename = os.path.join(destDir, 'index.yml')
fp = codecs.open(filename, 'w', 'utf-8') fp = codecs.open(filename, 'w', 'utf-8')
title = title.replace('\\', '\\\\') # Escape existing backslashes
fp.write(INDEX_YML % title.replace('"', '\\"')) fp.write(INDEX_YML % title.replace('"', '\\"'))
fp.close() fp.close()
os.chmod(filename, 0664) os.chmod(filename, 0664)