# HG changeset patch # User Ludovic Chabant # Date 1517417439 28800 # Node ID 75f1b446049156313b2b6feb3496c7ae7f2630f3 # Parent 94d7d5e38571b01100f804e563970cc2be8bfe81 sources: Fix ordering and filename confusion in the "ordered" source. diff -r 94d7d5e38571 -r 75f1b4460491 piecrust/sources/autoconfig.py --- 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):