Mercurial > piecrust2
diff piecrust/baking/baker.py @ 6:f5ca5c5bed85
More Python 3 fixes, modularization, and new unit tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 16 Aug 2014 08:15:30 -0700 |
parents | 474c9882decf |
children | 343d08ef5668 |
line wrap: on
line diff
--- a/piecrust/baking/baker.py Mon Aug 11 22:36:47 2014 -0700 +++ b/piecrust/baking/baker.py Sat Aug 16 08:15:30 2014 -0700 @@ -61,13 +61,15 @@ def getOutputPath(self, uri): bake_path = [self.out_dir] - decoded_uri = urllib.parse.unquote(uri.lstrip('/')).decode('utf8') + decoded_uri = urllib.parse.unquote(uri.lstrip('/')) if self.pretty_urls: bake_path.append(decoded_uri) bake_path.append('index.html') else: name, ext = os.path.splitext(decoded_uri) - if ext: + if decoded_uri == '': + bake_path.append('index.html') + elif ext: bake_path.append(decoded_uri) else: bake_path.append(decoded_uri + '.html') @@ -191,7 +193,7 @@ os.makedirs(out_dir, 0o755) with codecs.open(out_path, 'w', 'utf-8') as fp: - fp.write(rp.content.decode('utf-8')) + fp.write(rp.content) return ctx, rp