misc cleanup
This commit is contained in:
@ -14,11 +14,10 @@ from recipe_scrapers._utils import get_minutes
|
||||
|
||||
def get_from_scraper(scrape, space):
|
||||
# converting the scrape_me object to the existing json format based on ld+json
|
||||
|
||||
recipe_json = {}
|
||||
try:
|
||||
recipe_json['name'] = parse_name(scrape.title() or None)
|
||||
except (TypeError, AttributeError, ElementNotFoundInHtml, NotImplementedError):
|
||||
except Exception:
|
||||
recipe_json['name'] = None
|
||||
if not recipe_json['name']:
|
||||
try:
|
||||
@ -28,7 +27,7 @@ def get_from_scraper(scrape, space):
|
||||
|
||||
try:
|
||||
description = scrape.schema.data.get("description") or ''
|
||||
except (AttributeError, ElementNotFoundInHtml, NotImplementedError, SchemaOrgException):
|
||||
except Exception:
|
||||
description = ''
|
||||
|
||||
recipe_json['description'] = parse_description(description)
|
||||
|
@ -722,6 +722,7 @@
|
||||
msg += err.bodyText
|
||||
} else {
|
||||
msg += ' ' + err.status + ' ' + err.statusText
|
||||
this.preview = true
|
||||
}
|
||||
this.makeToast(gettext('Error'), msg, 'danger')
|
||||
})
|
||||
|
@ -680,7 +680,6 @@ def recipe_from_source(request):
|
||||
'images': images,
|
||||
})
|
||||
|
||||
|
||||
else:
|
||||
return JsonResponse(
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ def import_url(request):
|
||||
elif isinstance(ing['amount'], float) \
|
||||
or isinstance(ing['amount'], int):
|
||||
ingredient.amount = ing['amount']
|
||||
ingredient.note = ing['note'] if 'note' in ing else ''
|
||||
ingredient.note = ing['note'].strip() if 'note' in ing else ''
|
||||
|
||||
ingredient.save()
|
||||
step.ingredients.add(ingredient)
|
||||
|
Reference in New Issue
Block a user