1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-27 14:12:58 +02:00

Fix how types are compared in OscOptions.set_value_from_string()

Some python versions require '==' instead of 'is' operator, otherwise we get
TypeError: Field 'http_headers' has type 'typing.List[osc.conf.HttpHeader]'. Cannot assign a value with type 'str'.
This commit is contained in:
2025-06-03 13:48:30 +02:00
parent 4df8ac5e9d
commit 60e176f9bc

View File

@@ -207,12 +207,12 @@ class OscOptions(BaseModel):
setattr(self, field_name, None)
return
if field.origin_type is Password:
if field.origin_type == Password:
value = Password(value)
setattr(self, field_name, value)
return
if field.type is List[HttpHeader]:
if field.type == List[HttpHeader]:
value = http.client.parse_headers(BytesIO(value.strip().encode("utf-8"))).items()
setattr(self, field_name, value)
return