Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
978:7e51d14097cb | 979:45ad976712ec |
---|---|
29 if self._dict is not None: | 29 if self._dict is not None: |
30 return | 30 return |
31 | 31 |
32 self._dict = {} | 32 self._dict = {} |
33 for source in self._page.app.sources: | 33 for source in self._page.app.sources: |
34 pname = source.config.get('data_type') | 34 pname = source.config.get('data_type') or 'page_iterator' |
35 pendpoint = source.config.get('data_endpoint') | 35 pendpoint = source.config.get('data_endpoint') |
36 if not pname or not pendpoint: | 36 if not pname or not pendpoint: |
37 continue | 37 continue |
38 | 38 |
39 endpoint_bits = re_endpoint_sep.split(pendpoint) | 39 endpoint_bits = re_endpoint_sep.split(pendpoint) |
46 | 46 |
47 if existing is None: | 47 if existing is None: |
48 provider = build_data_provider(pname, source, self._page) | 48 provider = build_data_provider(pname, source, self._page) |
49 endpoint[endpoint_bits[-1]] = provider | 49 endpoint[endpoint_bits[-1]] = provider |
50 elif isinstance(existing, DataProvider): | 50 elif isinstance(existing, DataProvider): |
51 if existing.PROVIDER_NAME != pname: | 51 existing_source = existing._sources[0] |
52 if (existing.PROVIDER_NAME != pname or | |
53 existing_source.SOURCE_NAME != source.SOURCE_NAME): | |
52 raise ConfigurationError( | 54 raise ConfigurationError( |
53 "Can't combine data providers '%s' and '%' on " | 55 "Can't combine data providers '%s' and '%' " |
54 "endpoint '%s'." % | 56 "(using sources '%s' and '%s') " |
55 (existing.PROVIDER_NAME, pname, pendpoint)) | 57 "on endpoint '%s'." % |
58 (existing.PROVIDER_NAME, pname, | |
59 existing_source.SOURCE_NAME, source.SOURCE_NAME, | |
60 pendpoint)) | |
56 existing._addSource(source) | 61 existing._addSource(source) |
57 else: | 62 else: |
58 raise ConfigurationError( | 63 raise ConfigurationError( |
59 "Endpoint '%s' can't be used for a data provider because " | 64 "Endpoint '%s' can't be used for a data provider because " |
60 "it's already used for something else." % pendpoint) | 65 "it's already used for something else." % pendpoint) |