diff piecrust/rendering.py @ 23:923699e816d0

Don't try to get the name of a source that doesn't have one. TODO: clean up code duplication.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 19 Aug 2014 08:34:16 -0700
parents 30a42341cfa8
children 65ae19c4e8a3
line wrap: on
line diff
--- a/piecrust/rendering.py	Mon Aug 18 23:20:43 2014 -0700
+++ b/piecrust/rendering.py	Tue Aug 19 08:34:16 2014 -0700
@@ -4,6 +4,7 @@
 from piecrust.data.builder import (DataBuildingContext, build_page_data,
         build_layout_data)
 from piecrust.environment import PHASE_PAGE_FORMATTING, PHASE_PAGE_RENDERING
+from piecrust.sources.base import PageSource
 from piecrust.uriutil import get_slug
 
 
@@ -65,6 +66,10 @@
             raise Exception("Pagination has already been used.")
         self.used_pagination = paginator
 
+    def addUsedSource(self, source):
+        if isinstance(source, PageSource):
+            self.used_source_names.add(source.name)
+
 
 def render_page(ctx):
     eis = ctx.app.env.exec_info_stack