aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-01-18 06:46:56 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-01-18 06:46:56 -0600
commita8bf907a4ce82b8e6a48908936a3ec4edc845f7b (patch)
tree5aa466f8efda97c87b1e94254c802b4bad13d352
parentBump version: 0.3.1 → 0.3.2 (diff)
downloadconfig-file-a8bf907a4ce82b8e6a48908936a3ec4edc845f7b.zip
Fix typeerror with adding values that aren't strings
-rw-r--r--CHANGELOG.md9
-rw-r--r--config_file/parsers/ini_parser.py3
2 files changed, 12 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b982077..2180eb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## 0.3.3
+
+Fixed
+
+- `TypeError` when setting the key/value pairs since configparser requires the option
+ to be a string. The parser now just converts the value to a string if it is not one
+ and then adds the key/value pair. It would still be parsed correctly when retrieving
+ it.
+
## 0.3.2 - 2020-01-17
Changed
diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py
index 4e0922c..3c8f12f 100644
--- a/config_file/parsers/ini_parser.py
+++ b/config_file/parsers/ini_parser.py
@@ -60,6 +60,9 @@ class IniParser(BaseParser):
if value is not None and not self.parsed_content.has_section(section):
self.parsed_content.add_section(section)
+ if not isinstance(value, str):
+ value = str(value)
+
self.parsed_content.set(section, key, value)
return True