Mercurial > piecrust2
diff piecrust/sources/posts.py @ 101:d74ae33832ae
Fix a bug with the posts source incorrectly escaping regex characters.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 13 Sep 2014 23:31:47 -0700 |
parents | cb6eadea0845 |
children | 438509f12332 |
line wrap: on
line diff
--- a/piecrust/sources/posts.py Sat Sep 13 23:31:21 2014 -0700 +++ b/piecrust/sources/posts.py Sat Sep 13 23:31:47 2014 -0700 @@ -93,7 +93,8 @@ 'slug': '(?P<slug>.*)', 'ext': '(?P<ext>.*)' } - pattern = self.path_format % regex_repl + '$' + path_format_re = re.sub(r'([\-\.])', r'\\\1', self.path_format) + pattern = path_format_re % regex_repl + '$' m = re.search(pattern, path.replace('\\', '/')) if not m: raise Exception("Expected to be able to match path with path "