mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-28 06:27:11 +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:
@@ -207,12 +207,12 @@ class OscOptions(BaseModel):
|
|||||||
setattr(self, field_name, None)
|
setattr(self, field_name, None)
|
||||||
return
|
return
|
||||||
|
|
||||||
if field.origin_type is Password:
|
if field.origin_type == Password:
|
||||||
value = Password(value)
|
value = Password(value)
|
||||||
setattr(self, field_name, value)
|
setattr(self, field_name, value)
|
||||||
return
|
return
|
||||||
|
|
||||||
if field.type is List[HttpHeader]:
|
if field.type == List[HttpHeader]:
|
||||||
value = http.client.parse_headers(BytesIO(value.strip().encode("utf-8"))).items()
|
value = http.client.parse_headers(BytesIO(value.strip().encode("utf-8"))).items()
|
||||||
setattr(self, field_name, value)
|
setattr(self, field_name, value)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user