Only open files for writing

This commit is contained in:
Eric Holscher 2015-08-10 20:16:40 -07:00
parent 220599c22f
commit 999a031108

View File

@ -184,12 +184,12 @@ class DotNetSphinxMapper(SphinxMapperBase):
detail_dir = os.path.join(root, *filename.split('.'))
ensuredir(detail_dir)
path = os.path.join(detail_dir, '%s%s' % ('index', source_suffix))
with open(path, 'wb+') as detail_file:
with open(path, 'wb') as detail_file:
detail_file.write(rst.encode('utf-8'))
# Render Top Index
top_level_index = os.path.join(root, 'index.rst')
with open(top_level_index, 'wb+') as top_level_file:
with open(top_level_index, 'wb') as top_level_file:
content = self.jinja_env.get_template('index.rst')
top_level_file.write(content.render(pages=self.namespaces.values()).encode('utf-8'))