From 49080bc7f161c0b6ee522f23ace5e398b5237b5b Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 29 Dec 2015 10:00:56 +0100 Subject: [PATCH] Move iteration of sub-content errors into the ContentList.iter_errors() iterator --- patacrep/build.py | 4 ---- patacrep/content/__init__.py | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/patacrep/build.py b/patacrep/build.py index f2c50036..12315447 100644 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -131,10 +131,6 @@ class Songbook: yield from self._errors contentlist = self._config.get('content', content.ContentList()) yield from contentlist.iter_errors() - for item in contentlist: - if not hasattr(item, "iter_errors"): - continue - yield from item.iter_errors() def requires_lilypond(self): """Tell if lilypond is part of the bookoptions""" diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index 7cdc7061..85f6b7a4 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -185,6 +185,10 @@ class ContentList: def iter_errors(self): """Iterate over errors.""" yield from self._errors + for item in self: + if not hasattr(item, "iter_errors"): + continue + yield from item.iter_errors() class EmptyContentList(ContentList): """Empty content list: contain only errors."""