mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-14 15:57:27 +00:00
Config: Fix existing value check
If a sub-field exists in the model provided to the file generator, use it. Otherwise always fallback to the default factory. This prevents any subsequent errors from setting None. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -496,8 +496,8 @@ def generate_config_file(
|
||||
for field, field_data in schema.model_fields.items():
|
||||
# Fetch from the existing model class if it's passed
|
||||
# Probably can use this on schema too, but play it safe
|
||||
if model:
|
||||
subfield_model = getattr(model, field, None)
|
||||
if model and hasattr(model, field):
|
||||
subfield_model = getattr(model, field)
|
||||
else:
|
||||
subfield_model = field_data.default_factory()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user