[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2022-02-09 Thread Ben Griffin


Ben Griffin  added the comment:

This is still being ignored.  
It's a bug, because it prevents the ini file from being used by other clients.

--
versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Ben Griffin


Ben Griffin  added the comment:

Having looked at the code, I believe that it is best NOT to interfere with the 
'default_section' value of the class, as it is used as a proxy to _defaults, 
whereas the section parameter of get() is easily extended.

The actual changes are all to the method _unify_values, and it is trivial to 
extend that method to allow for multiple dictionaries to be passed to _ChainMap.

This is what I did in PR-18791

--
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +18148
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18791

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Ben Griffin


New submission from Ben Griffin :

While there is now support for a single default group, mysql documentation is 
clear that there is a cascade of groups for option settings, normally starting 
with [client], and including version numbers..

This allows generic settings to be overridden by specific settings, and it's an 
important feature when building an architecture around a mysql/mariadb 
environment.

A typical configuration chain may look like this.

[client] -> [mysql] -> [mysql-5.6] -> [pymysql] -> [my_custom_app]

Currently, the implementation of configparser only allows the programmer to 
define the default group (typically [client]) and then the group to read from 
[my_custom_app].

In terms of a proposed approach to the library, I suggest two changes (both 
backwards compatible).
(1) Extend the 'default_section' initializer such that it supports both a 
string (current implementation) and an iterable (ordered from specialised to 
general).

(2) Likewise extend the 'section' parameter of get() such that it supports both 
a string (current implementation) and an iterable (ordered from specialised to 
general), as above.

Mysql's own docs are as follows.

https://dev.mysql.com/doc/refman/8.0/en/option-files.html#option-file-syntax

"List more general option groups first and more specific groups later. For 
example, a [client] group is more general because it is read by all client 
programs, whereas a [mysqldump] group is read only by mysqldump. Options 
specified later override options specified earlier, so putting the option 
groups in the order [client], [mysqldump] enables mysqldump-specific options to 
override [client] options."

--
components: Library (Lib)
messages: 363421
nosy: Ben Griffin
priority: normal
severity: normal
status: open
title: configparser - no support for cascading defaults (as defined by MySQL)
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com