Mercurial > piecrust2
diff piecrust/sources/autoconfig.py @ 1054:75f1b4460491
sources: Fix ordering and filename confusion in the "ordered" source.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 31 Jan 2018 08:50:39 -0800 |
parents | f8572df0756e |
children | 3d71cd95f90a |
line wrap: on
line diff
--- a/piecrust/sources/autoconfig.py Sun Jan 28 21:22:03 2018 -0800 +++ b/piecrust/sources/autoconfig.py Wed Jan 31 08:50:39 2018 -0800 @@ -161,7 +161,7 @@ else: # Find each sub-directory. It can either be a directory with # the name itself, or the name with a number prefix. - p_pat = r'(\d+_)?' + re.escape(p) + p_pat = r'(\d+_)?' + re.escape(p) + '$' found = False for name in os.listdir(path): if re.match(p_pat, name): @@ -182,6 +182,12 @@ return OrderTrailSortIterator(it, self.setting_name + '_trail', value_accessor=accessor) + def _finalizeContent(self, parent_group, items, groups): + super()._finalizeContent(parent_group, items, groups) + + sn = self.setting_name + items.sort(key=lambda i: i.metadata['config'][sn]) + def _extractConfigFragment(self, rel_path): values = [] for m in self.re_pattern.finditer(rel_path):