Skip to content

Commit

Permalink
config: cleanup bool cfg validation
Browse files Browse the repository at this point in the history
Cleaning up the instance checking when sanity checking a boolean value.
This simplifies an instance check and also removed an unneeded instance
check.

Signed-off-by: James Knight <james.d.knight@live.com>
  • Loading branch information
jdknight committed Mar 3, 2024
1 parent 336e231 commit 43b34c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sphinxcontrib/confluencebuilder/config/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def bool(self):
value = self._value()

if value is not None:
if isinstance(value, str) or isinstance(value, int):
if isinstance(value, (int, str)):
try:
str2bool(value)
except ValueError as ex:
msg = f'{self.key} is not a boolean string'
raise ConfluenceConfigError(msg) from ex
elif not isinstance(value, bool) and not isinstance(value, int):
elif not isinstance(value, bool):
msg = f'{self.key} is not a boolean type'
raise ConfluenceConfigError(msg)

Expand Down

0 comments on commit 43b34c8

Please sign in to comment.