# HG changeset patch # User Ludovic Chabant # Date 1392135006 28800 # Node ID 067eca50f8f7ff71ef467ed14e423ab9e3978085 # Parent cbf7db1ff0d5055b989999062f6697db0fd2d283 Fixed crash creating pages in new folders, or with spaces. diff -r cbf7db1ff0d5 -r 067eca50f8f7 wikked/fs.py --- 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)