From 0989a58af5ef18ffbedc645cc224b55998051685 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 17 Feb 2024 10:52:08 +0100 Subject: [PATCH] fixed rezeptsuite importer --- cookbook/integration/rezeptsuitede.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbook/integration/rezeptsuitede.py b/cookbook/integration/rezeptsuitede.py index afe3e543c..3df814240 100644 --- a/cookbook/integration/rezeptsuitede.py +++ b/cookbook/integration/rezeptsuitede.py @@ -1,6 +1,6 @@ import base64 from io import BytesIO -from xml import etree +from lxml import etree from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.recipe_url_import import parse_servings, parse_servings_text @@ -53,7 +53,10 @@ class Rezeptsuitede(Integration): u = ingredient_parser.get_unit(ingredient.attrib['unit']) amount = 0 if ingredient.attrib['qty'].strip() != '': - amount, unit, note = ingredient_parser.parse_amount(ingredient.attrib['qty']) + try: + amount, unit, note = ingredient_parser.parse_amount(ingredient.attrib['qty']) + except ValueError: # sometimes quantities contain words which cant be parsed + pass ingredient_step.ingredients.add(Ingredient.objects.create(food=f, unit=u, amount=amount, space=self.request.space, )) try: