mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
catch error when trying to parse into ingredient/note
This commit is contained in:
@@ -129,6 +129,9 @@ def parse(x):
|
|||||||
# only two arguments, first one is the amount which means this is the ingredient
|
# only two arguments, first one is the amount which means this is the ingredient
|
||||||
ingredient = tokens[1]
|
ingredient = tokens[1]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# can't parse first argument as amount -> no unit -> parse everything as ingredient
|
try:
|
||||||
ingredient, note = parse_ingredient(tokens)
|
# can't parse first argument as amount -> no unit -> parse everything as ingredient
|
||||||
|
ingredient, note = parse_ingredient(tokens)
|
||||||
|
except ValueError:
|
||||||
|
ingredient = ' '.join(tokens[1:])
|
||||||
return amount, unit.strip(), ingredient.strip(), note.strip()
|
return amount, unit.strip(), ingredient.strip(), note.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user