Skip to content

Commit

Permalink
fixed rezeptsuite importer
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Feb 17, 2024
1 parent 2782589 commit 0989a58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cookbook/integration/rezeptsuitede.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,7 +53,10 @@ def get_recipe_from_file(self, file):
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:
Expand Down

0 comments on commit 0989a58

Please sign in to comment.