Mercurial > piecrust2
diff piecrust/data/providersdata.py @ 979:45ad976712ec
tests: Big push to get the tests to pass again.
- Lots of fixes everywhere in the code.
- Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now.
- Replace all `.md` test files with `.html` since now a auto-format extension always sets the format.
- Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 Oct 2017 22:51:57 -0700 |
parents | 08e02c2a2a1a |
children | ed308313bcda |
line wrap: on
line diff
--- a/piecrust/data/providersdata.py Sun Oct 29 22:46:41 2017 -0700 +++ b/piecrust/data/providersdata.py Sun Oct 29 22:51:57 2017 -0700 @@ -31,7 +31,7 @@ self._dict = {} for source in self._page.app.sources: - pname = source.config.get('data_type') + pname = source.config.get('data_type') or 'page_iterator' pendpoint = source.config.get('data_endpoint') if not pname or not pendpoint: continue @@ -48,11 +48,16 @@ provider = build_data_provider(pname, source, self._page) endpoint[endpoint_bits[-1]] = provider elif isinstance(existing, DataProvider): - if existing.PROVIDER_NAME != pname: + existing_source = existing._sources[0] + if (existing.PROVIDER_NAME != pname or + existing_source.SOURCE_NAME != source.SOURCE_NAME): raise ConfigurationError( - "Can't combine data providers '%s' and '%' on " - "endpoint '%s'." % - (existing.PROVIDER_NAME, pname, pendpoint)) + "Can't combine data providers '%s' and '%' " + "(using sources '%s' and '%s') " + "on endpoint '%s'." % + (existing.PROVIDER_NAME, pname, + existing_source.SOURCE_NAME, source.SOURCE_NAME, + pendpoint)) existing._addSource(source) else: raise ConfigurationError(