fixed rezeptsuite importer

This commit is contained in:
vabene1111 2024-02-17 10:52:08 +01:00
parent 278258946f
commit 0989a58af5

View File

@ -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() != '':
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: