comparison piecrust/sources/fs.py @ 1060:3678cddf99f9

sources: Improve error message when trying to get children pages on a group.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Feb 2018 11:12:29 -0800
parents 895f49c9833d
children a6618fdab37e
comparison
equal deleted inserted replaced
1059:292e3a1316d8 1060:3678cddf99f9
161 161
162 if relationship == REL_LOGICAl_CHILD_GROUP: 162 if relationship == REL_LOGICAl_CHILD_GROUP:
163 # If we want the children items of an item, we look for 163 # If we want the children items of an item, we look for
164 # a directory that has the same name as the item's file. 164 # a directory that has the same name as the item's file.
165 if item.is_group: 165 if item.is_group:
166 raise ValueError() 166 raise ValueError(
167 "'%s' is a content group and doesn't have a logical "
168 "child. Did you call `family.children` on a group? "
169 "You need to check `is_group` first.")
167 dir_path, _ = os.path.splitext(item.spec) 170 dir_path, _ = os.path.splitext(item.spec)
168 if os.path.isdir(dir_path): 171 if os.path.isdir(dir_path):
169 metadata = self._createGroupMetadata(dir_path) 172 metadata = self._createGroupMetadata(dir_path)
170 return ContentGroup(dir_path, metadata) 173 return ContentGroup(dir_path, metadata)
171 return None 174 return None