Mercurial > piecrust2
diff piecrust/routing.py @ 396:dc0988d937b3
serve: Fix bug where `?!debug` doesn't get appending correctly.
Add unit test.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 18 May 2015 15:35:52 -0700 |
parents | f33712c4cfab |
children | 21e26ed867b6 |
line wrap: on
line diff
--- a/piecrust/routing.py Sun May 17 15:28:23 2015 -0700 +++ b/piecrust/routing.py Mon May 18 15:35:52 2015 -0700 @@ -33,6 +33,7 @@ self.pretty_urls = app.config.get('site/pretty_urls') self.trailing_slash = app.config.get('site/trailing_slash') + self.show_debug_info = app.config.get('site/show_debug_info') self.pagination_suffix_format = app.config.get( '__cache/pagination_suffix_format') self.uri_root = app.config.get('site/root') @@ -40,8 +41,6 @@ uri = cfg['url'] self.uri_pattern = uri.lstrip('/') self.uri_format = route_re.sub(self._uriFormatRepl, self.uri_pattern) - if app.config.get('site/show_debug_info'): - self.uri_format += '?!debug' # Get the straight-forward regex for matching this URI pattern. p = route_esc_re.sub(self._uriPatternRepl, @@ -171,6 +170,10 @@ uri = base_uri + ext uri = self.uri_root + uri + + if self.show_debug_info: + uri += '?!debug' + return uri def slugifyTaxonomyTerm(self, term):