Skip to content

Commit

Permalink
Accept more "truth values" in DB editor (#3044)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen authored Feb 5, 2025
2 parents 3de77d6 + c8cd641 commit abb82b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spinetoolbox/spine_db_editor/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Helpers and utilities for Spine Database editor."""
from PySide6.QtGui import QColor
from spinedb_api.helpers import string_to_bool as base_string_to_bool


def string_to_display_icon(x):
Expand All @@ -31,8 +32,6 @@ def string_to_display_icon(x):

TRUE_STRING = "true"
FALSE_STRING = "false"
GENERIC_TRUE = TRUE_STRING.casefold()
GENERIC_FALSE = FALSE_STRING.casefold()


def string_to_bool(x):
Expand All @@ -44,7 +43,10 @@ def string_to_bool(x):
Returns:
bool: boolean value
"""
return x.casefold() == GENERIC_TRUE
try:
return base_string_to_bool(x)
except ValueError:
return False


def table_name_from_item_type(item_type):
Expand Down

0 comments on commit abb82b4

Please sign in to comment.