[py-configparser-devel] get-option: inheritance from `default' broken.
Станислав Кондратьев
kondratjevsk at gmail.com
Tue Aug 27 16:40:16 UTC 2013
Hello,
In Python's configparser the default section is supposed to supply
missing options for the rest sections. In py-configparser this
doesn't work. I suggest fixing %get-option as follows:
(defun %get-option (config section-name option-name if-does-not-exist)
(let* ((section (%get-section config section-name))
(norm-option (norm-option-name config option-name))
(option (or (assoc norm-option
(section-options section)
:test #'string=)
(assoc norm-option
(section-options (config-defaults config))
:test #'string=))))
(if (null option)
(if (eq if-does-not-exist :error)
(error 'no-option-error) ;; no such option error
(values (car (push (list (%validate-option-name norm-option))
(section-options section)))
section))
(values option section))))
Best regards,
Stanislav Kondratyev.
More information about the py-configparser-devel
mailing list