mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
Ignore some fields in strict verification
Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
parent
1834f3e304
commit
d96393f9c9
1 changed files with 4 additions and 0 deletions
|
@ -36,6 +36,7 @@ from mealie.services.scraper import cleaner
|
||||||
|
|
||||||
from .template_service import TemplateService
|
from .template_service import TemplateService
|
||||||
|
|
||||||
|
POSSIBLE_NONE_FIELDS = [ "image" ]
|
||||||
|
|
||||||
class RecipeServiceBase(BaseService):
|
class RecipeServiceBase(BaseService):
|
||||||
def __init__(self, repos: AllRepositories, user: PrivateUser, household: HouseholdInDB, translator: Translator):
|
def __init__(self, repos: AllRepositories, user: PrivateUser, household: HouseholdInDB, translator: Translator):
|
||||||
|
@ -387,6 +388,9 @@ class RecipeService(RecipeServiceBase):
|
||||||
|
|
||||||
if strict:
|
if strict:
|
||||||
for field in new_data.__class__.model_fields:
|
for field in new_data.__class__.model_fields:
|
||||||
|
if field in POSSIBLE_NONE_FIELDS:
|
||||||
|
continue
|
||||||
|
|
||||||
if getattr(new_data, field) is None:
|
if getattr(new_data, field) is None:
|
||||||
raise exceptions.IncompleteData(f"Incomplete recipe, missing {field}")
|
raise exceptions.IncompleteData(f"Incomplete recipe, missing {field}")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue