- Keep existing options and sections intact when assigning a replacement that
is already attached to another container and raisesAlreadyAttachedError,
PR #189 - Behavior change: Removing an option or section with
del,pop(),
popitem(),remove_option()orremove_section()detaches it, as
clear()anddetach()already do, so it can be added to another section or
document instead of raisingAlreadyAttachedError. Like any detached block, it
no longer reaches its former parent:Option.key,Option.section,
Section.documentand reading or changing the options of a removed section,
e.g.section["key"],in,get(),set()orto_dict(), raise
NotAttachedErroruntil it is added again.Option.value,
Option.raw_keyandSection.namekeep working. A section popped from
ConfigParsercannot be read either, so read it before removing it
(follow-up to PR #180), PR #188 - Behavior change:
updater[key] = sectionraises aValueErrorif the
section's name is notkeyalso when it replaces an existing section, as it
already did when it adds one. Before,updater["a"] = updater["b"]put the same
section twice into the document, and a copied or detached section replaced
[a]under its own name, soupdater["a"]was gone afterwards. ConfigParser
copies the options ofbintoainstead; to do the same, assign a
copy.deepcopyofbrenamed toa. The error message now says "section
name" instead of "option key", PR #191 update_file()encodes the configuration before it opens the file, so a value
that the file's encoding cannot represent raisesUnicodeEncodeErrorand leaves
the file untouched instead of emptying it (follow-up to PR #165), PR #190- Behavior change:
items(section)raisesNoSectionErrorinstead of
KeyErrorfor a missing section, likeConfigParser.items()and the other
methods that take a section name, e.g.options(),get()andset(),
PR #193 - Renaming an option by setting
Option.keykeeps its original lines and only
replaces the key, so the continuation lines of a multi-line value stay indented
instead of turning into new options. A renamed option also keeps its delimiter
spacing, e.g.opt=42becomesnew=42instead ofnew = 42, issue #195 set()leaves the section unchanged when it rejects the value, e.g. a multi-line
string, or when iterating over the values raises. Before, it had already added the
new option without a value and could add a newline to the line before it, PR #197- Behavior change:
section[key] = valueand the builder'soption(key, value)raiseAssignMultilineValueErrorfor a multi-line string also when they
create a new option, as assigning it to an existing option already does. Before,
the string was written as is, which gave an invalid file unless its continuation
lines were indented. Useset(key, lines)orOption.set_values()for a
multi-line value, PR #202 - Use the configured
optionxforminvalidate_format(),write()and
update_file(). Case-sensitive options can be saved without false duplicate
errors, and duplicates introduced by custom normalization are rejected
(follow-up to PR #69), PR #203 - Behavior change: Reading a section with two options whose keys are equal after
optionxform, e.g.Keyandkeywith the default lowercase
transformation, raisesDuplicateOptionErrorlikeConfigParser. Before, only
options with the same spelling were duplicates, so such a file was read, but
write()andupdate_file()refused to save it. Options keep the spelling of
their keys as before, PR #204