Skip to content

Commit

Permalink
Allow LazyString types for ConfigurationFormItem arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdilauro committed Nov 1, 2024
1 parent 7457a46 commit 0e4ee00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/palace/manager/api/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class Axis360Settings(BaseCirculationApiSettings):
form=ConfigurationFormItem(
label=_("Verify SSL Certificate"),
description=_(
"This should always be True in production, it may need to be set to False to use the"
"Axis 360 QA Environment."
"This should always be True in production; though, it may need "
"to be set to False to use the Axis 360 QA Environment."
),
type=ConfigurationFormItemType.SELECT,
options={
Expand Down
9 changes: 5 additions & 4 deletions src/palace/manager/integration/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from enum import Enum
from typing import Any, Union
from typing import Any

import annotated_types
import typing_extensions
from flask_babel import LazyString
from pydantic import (
AliasChoices,
AliasPath,
Expand Down Expand Up @@ -187,7 +188,7 @@ class ConfigurationFormItemType(Enum):
IMAGE = "image"


ConfigurationFormOptionsType = Mapping[Union[Enum, str, None], str]
ConfigurationFormOptionsType = Mapping[Enum | str | None, str | LazyString]


@dataclass(frozen=True)
Expand All @@ -201,14 +202,14 @@ class ConfigurationFormItem:
"""

# The label for the form item, used as the field label in the admin interface.
label: str
label: str | LazyString

# The type of the form item, used to determine the type of the field displayed
# in the admin interface.
type: ConfigurationFormItemType = ConfigurationFormItemType.TEXT

# The description of the form item, displayed below the field in the admin interface.
description: str | None = None
description: str | LazyString | None = None

# The format of the form item, in some cases used to determine the format of the field
# displayed in the admin interface.
Expand Down

0 comments on commit 0e4ee00

Please sign in to comment.