Mercurial > mozilla > hg > DocumentIt
diff document_it.py @ 19:493683e17eae
now renders correctly to filesystem for preview
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 02 Aug 2011 19:45:34 -0700 |
parents | f7dc318832dc |
children | 7299c4529b41 |
line wrap: on
line diff
--- a/document_it.py Tue Aug 02 19:14:32 2011 -0700 +++ b/document_it.py Tue Aug 02 19:45:34 2011 -0700 @@ -159,7 +159,16 @@ # create a directory if needed dirname = os.path.dirname(dest) if os.path.exists(dirname): - assert os.path.isdir(dirname), "%s exists and is not a directory" % dirname + if not os.path.isdir(dirname): + # deal with filesystem directories vs PATH_INFO + f = file(dirname) + buffer = f.read() + f.close() + os.remove(dirname) + os.makedirs(dirname) + f = file(os.path.join(dirname, 'index.html'), 'w') + f.write(buffer) + f.close() else: os.makedirs(dirname)