Mercurial > piecrust2
comparison piecrust/data/base.py @ 392:923a9b96411d
data: Fix regression bug with accessing page metadata that doesn't exist.
Added unit test.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 17 May 2015 15:25:54 -0700 |
parents | 4c9eab0e283b |
children | fd8e39254da0 |
comparison
equal
deleted
inserted
replaced
391:3e4bb57d8506 | 392:923a9b96411d |
---|---|
87 raise Exception( | 87 raise Exception( |
88 "Error while loading attribute '%s' for: %s" % | 88 "Error while loading attribute '%s' for: %s" % |
89 (name, self._page.rel_path)) from ex | 89 (name, self._page.rel_path)) from ex |
90 # We always keep the wildcard loader in the loaders list. | 90 # We always keep the wildcard loader in the loaders list. |
91 | 91 |
92 assert name in self._values | 92 if name not in self._values: |
93 raise LazyPageConfigLoaderHasNoValue() | |
93 return self._values[name] | 94 return self._values[name] |
94 | 95 |
95 def _setValue(self, name, value): | 96 def _setValue(self, name, value): |
96 if self._values is None: | 97 if self._values is None: |
97 raise Exception("Can't call _setValue before this data has been " | 98 raise Exception("Can't call _setValue before this data has been " |