Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
22:df790a827d38 | 23:923699e816d0 |
---|---|
2 import os.path | 2 import os.path |
3 import logging | 3 import logging |
4 from piecrust.data.builder import (DataBuildingContext, build_page_data, | 4 from piecrust.data.builder import (DataBuildingContext, build_page_data, |
5 build_layout_data) | 5 build_layout_data) |
6 from piecrust.environment import PHASE_PAGE_FORMATTING, PHASE_PAGE_RENDERING | 6 from piecrust.environment import PHASE_PAGE_FORMATTING, PHASE_PAGE_RENDERING |
7 from piecrust.sources.base import PageSource | |
7 from piecrust.uriutil import get_slug | 8 from piecrust.uriutil import get_slug |
8 | 9 |
9 | 10 |
10 logger = logging.getLogger(__name__) | 11 logger = logging.getLogger(__name__) |
11 | 12 |
63 def setPagination(self, paginator): | 64 def setPagination(self, paginator): |
64 if self.used_pagination is not None: | 65 if self.used_pagination is not None: |
65 raise Exception("Pagination has already been used.") | 66 raise Exception("Pagination has already been used.") |
66 self.used_pagination = paginator | 67 self.used_pagination = paginator |
67 | 68 |
69 def addUsedSource(self, source): | |
70 if isinstance(source, PageSource): | |
71 self.used_source_names.add(source.name) | |
72 | |
68 | 73 |
69 def render_page(ctx): | 74 def render_page(ctx): |
70 eis = ctx.app.env.exec_info_stack | 75 eis = ctx.app.env.exec_info_stack |
71 eis.pushPage(ctx.page, PHASE_PAGE_RENDERING, ctx) | 76 eis.pushPage(ctx.page, PHASE_PAGE_RENDERING, ctx) |
72 try: | 77 try: |