personalization.ConfigurableParameter: fix BytesIO() input

Change-Id: I0ad160eef9015e76eef10baee7c6b606fe249123
This commit is contained in:
Neels Hofmeyr
2025-08-04 00:40:13 +02:00
parent 58aafe36c7
commit 6b68e7b54d
3 changed files with 193 additions and 0 deletions

View File

@@ -198,6 +198,9 @@ class ConfigurableParameter:
if cls.allow_chars is not None:
if any(c not in cls.allow_chars for c in val):
raise ValueError(f"invalid characters in input value {val!r}, valid chars are {cls.allow_chars}")
elif isinstance(val, io.BytesIO):
val = val.getvalue()
if cls.allow_len is not None:
l = cls.allow_len
# cls.allow_len could be one int, or a tuple of ints. Wrap a single int also in a tuple.