Commit 4bf9228
authored
docs: fix merge order in the config how-to (#529)
The example under "Merging config from multiple sources" merges in the
wrong direction. Its comment claims it iterates "from least specific
(site) to most specific (user)", but the iterators yield the user
directory first:
```pycon
>>> list(PlatformDirs("MyApp").iter_config_paths())
[PosixPath('/Users/me/Library/Application Support/MyApp'), PosixPath('/Library/Application Support/MyApp')]
```
So `config.update()` applies the site file last and the site defaults
overwrite the user's own config, the opposite of what the paragraph
above the block promises.
With a site `config.json` of `{"theme": "site-default", "lang": "en"}`
and a user one of `{"theme": "user-choice"}`, the documented loop yields
`theme: site-default`. Reversing it yields `theme: user-choice` and
still inherits `lang` from the site file.
Found while reviewing #524, which cites this example as the use case its
iterators serve. Docs only, no behaviour change.1 parent c653668 commit 4bf9228
3 files changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
0 commit comments