Commit eca7b4c2 authored by Duggan, John's avatar Duggan, John
Browse files

Fix crash when using non-class type annotations with InputField

parent 3b3f77a2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[tool.poetry]
name = "nova-trame"
version = "0.17.2"
version = "0.17.3"
description = "A Python Package for injecting curated themes and custom components into Trame applications"
authors = ["Duggan, John <dugganjw@ornl.gov>"]
readme = "README.md"
+6 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import logging
import os
import re
from enum import Enum
from inspect import isclass
from typing import Any, Dict, Optional, Union

from trame.app import get_server
@@ -70,7 +71,11 @@ class InputField:
                    "rules": (f"[(v) => trigger('validate_pydantic_field', ['{field}', v, index])]",),
                }

                if field_type in ["autocomplete", "combobox", "select"] and issubclass(field_info.annotation, Enum):
                if (
                    field_type in ["autocomplete", "combobox", "select"]
                    and isclass(field_info.annotation)
                    and issubclass(field_info.annotation, Enum)
                ):
                    args |= {"items": str([option.value for option in field_info.annotation])}

            if debounce > 0 and throttle > 0: