diff piecrust/baking/single.py @ 836:dca51cd8147a

Merge pull request #42 from GitHub. Also cleanup the code a bit.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 05 Feb 2017 22:50:12 -0800
parents 18978cf6d1ac cc9593b9bcbf
children 92a98c84a925
line wrap: on
line diff
--- a/piecrust/baking/single.py	Sun Feb 05 22:42:18 2017 -0800
+++ b/piecrust/baking/single.py	Sun Feb 05 22:50:12 2017 -0800
@@ -55,12 +55,12 @@
         self._writer_queue.put_nowait(None)
         self._writer.join()
 
-    def getOutputPath(self, uri):
+    def getOutputPath(self, uri, pretty_urls):
         uri_root, uri_path = split_uri(self.app, uri)
 
         bake_path = [self.out_dir]
         decoded_uri = urllib.parse.unquote(uri_path)
-        if self.pretty_urls:
+        if pretty_urls:
             bake_path.append(decoded_uri)
             bake_path.append('index.html')
         elif decoded_uri == '':
@@ -81,7 +81,9 @@
             # Get the URL and path for this sub-page.
             sub_uri = qualified_page.getUri(cur_sub)
             logger.debug("Baking '%s' [%d]..." % (sub_uri, cur_sub))
-            out_path = self.getOutputPath(sub_uri)
+            pretty_urls = qualified_page.config.get('pretty_urls',
+                                                    self.pretty_urls)
+            out_path = self.getOutputPath(sub_uri, pretty_urls)
 
             # Create the sub-entry for the bake record.
             sub_entry = SubPageBakeInfo(sub_uri, out_path)
@@ -154,7 +156,7 @@
             # Copy page assets.
             if (cur_sub == 1 and self.copy_assets and
                     sub_entry.anyPass(lambda p: p.used_assets)):
-                if self.pretty_urls:
+                if pretty_urls:
                     out_assets_dir = os.path.dirname(out_path)
                 else:
                     out_assets_dir, out_name = os.path.split(out_path)