Mercurial > wikked
changeset 197:067eca50f8f7
Fixed crash creating pages in new folders, or with spaces.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 11 Feb 2014 08:10:06 -0800 |
parents | cbf7db1ff0d5 |
children | c5e7144f1181 |
files | wikked/fs.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/fs.py Sun Feb 09 20:46:22 2014 -0800 +++ b/wikked/fs.py Tue Feb 11 08:10:06 2014 -0800 @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) -valid_filename_pattern = re.compile('^[\w\.\-\(\)\[\]\\/]+$', re.UNICODE) +valid_filename_pattern = re.compile('^[\w \.\-\(\)\[\]\\/]+$', re.UNICODE) class PageInfo(object): @@ -93,6 +93,9 @@ def setPage(self, url, content): path = self.getPhysicalPagePath(url, make_new=True) logger.debug("Saving page '%s' to: %s" % (url, path)) + dirname = os.path.dirname(path) + if not os.path.isdir(dirname): + os.makedirs(dirname, 0775) with codecs.open(path, 'w', encoding='utf-8') as f: f.write(content) return PageInfo(url, path)