From ca84da68c49d2aa95786ab15203f30eda482f9f2 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 15 Apr 2021 18:39:44 -0500 Subject: [PATCH] catch attibute error when scrape missing schema --- cookbook/helper/recipe_url_import.py | 2 +- recipes/settings.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 8166fa47..eb93be70 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -16,7 +16,7 @@ def get_from_scraper(scrape, space): recipe_json = {} try: recipe_json['name'] = parse_name(scrape.title() or scrape.schema.data.get('name') or '') - except TypeError: + except (TypeError, AttributeError): recipe_json['name'] = '' try: diff --git a/recipes/settings.py b/recipes/settings.py index 4f0b1c8d..59808f21 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -11,8 +11,6 @@ https://docs.djangoproject.com/en/2.0/ref/settings/ """ import ast import os -import random -import string from corsheaders.defaults import default_headers from django.contrib import messages