# HG changeset patch # User Ludovic Chabant # Date 1431988552 25200 # Node ID dc0988d937b3683128b37c9cfe31fa9cfb447b5a # Parent 9e25852f058b362c82e5dbecea8e2f04a62017d4 serve: Fix bug where `?!debug` doesn't get appending correctly. Add unit test. diff -r 9e25852f058b -r dc0988d937b3 piecrust/routing.py --- 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): diff -r 9e25852f058b -r dc0988d937b3 tests/servings/test_debug_info.serve --- a/tests/servings/test_debug_info.serve Sun May 17 15:28:23 2015 -0700 +++ b/tests/servings/test_debug_info.serve Mon May 18 15:35:52 2015 -0700 @@ -14,3 +14,30 @@ out_contains: | BLAH