Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
100:69d5eecfa449 | 101:d74ae33832ae |
---|---|
91 'month': '(?P<month>\d{2})', | 91 'month': '(?P<month>\d{2})', |
92 'day': '(?P<day>\d{2})', | 92 'day': '(?P<day>\d{2})', |
93 'slug': '(?P<slug>.*)', | 93 'slug': '(?P<slug>.*)', |
94 'ext': '(?P<ext>.*)' | 94 'ext': '(?P<ext>.*)' |
95 } | 95 } |
96 pattern = self.path_format % regex_repl + '$' | 96 path_format_re = re.sub(r'([\-\.])', r'\\\1', self.path_format) |
97 pattern = path_format_re % regex_repl + '$' | |
97 m = re.search(pattern, path.replace('\\', '/')) | 98 m = re.search(pattern, path.replace('\\', '/')) |
98 if not m: | 99 if not m: |
99 raise Exception("Expected to be able to match path with path " | 100 raise Exception("Expected to be able to match path with path " |
100 "format: %s" % path) | 101 "format: %s" % path) |
101 fac_metadata = { | 102 fac_metadata = { |