fixed another importer issue
This commit is contained in:
parent
dd07c56ede
commit
4ec313f752
@ -75,7 +75,6 @@ def find_recipe_json(ld_json, url):
|
|||||||
amount = 0
|
amount = 0
|
||||||
unit = ''
|
unit = ''
|
||||||
if len(ingredient_split) > 2:
|
if len(ingredient_split) > 2:
|
||||||
|
|
||||||
ingredient = " ".join(ingredient_split[2:])
|
ingredient = " ".join(ingredient_split[2:])
|
||||||
unit = ingredient_split[1]
|
unit = ingredient_split[1]
|
||||||
|
|
||||||
@ -83,6 +82,8 @@ def find_recipe_json(ld_json, url):
|
|||||||
if 'fraction' in unicodedata.decomposition(ingredient_split[0]):
|
if 'fraction' in unicodedata.decomposition(ingredient_split[0]):
|
||||||
frac_split = unicodedata.decomposition(ingredient_split[0]).split()
|
frac_split = unicodedata.decomposition(ingredient_split[0]).split()
|
||||||
amount = round(float((frac_split[1]).replace('003', '')) / float((frac_split[3]).replace('003', '')), 3)
|
amount = round(float((frac_split[1]).replace('003', '')) / float((frac_split[3]).replace('003', '')), 3)
|
||||||
|
else:
|
||||||
|
raise TypeError
|
||||||
except TypeError: # raised by unicodedata.decomposition if there was no unicode character in parsed data
|
except TypeError: # raised by unicodedata.decomposition if there was no unicode character in parsed data
|
||||||
try:
|
try:
|
||||||
amount = float(ingredient_split[0].replace(',', '.'))
|
amount = float(ingredient_split[0].replace(',', '.'))
|
||||||
|
Loading…
Reference in New Issue
Block a user