Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fixed unnapropiate handling of missing django module in djangitem tests

Pablo Hoffman5ba466a6e1e7
diff --git a/scrapy/tests/test_djangoitem/__init__.py b/scrapy/tests/test_djangoitem/__init__.py
index c81091456..3b0be932a 100644
--- a/scrapy/tests/test_djangoitem/__init__.py
+++ b/scrapy/tests/test_djangoitem/__init__.py
@@ -6,10 +6,14 @@ from scrapy.contrib_exp.djangoitem import DjangoItem, Field
os.environ['DJANGO_SETTINGS_MODULE'] = 'scrapy.tests.test_djangoitem.settings'
try:
- from models import Person
- django = True
+ import django
except ImportError:
- django = False
+ django = None
+
+if django:
+ from models import Person
+else:
+ Person = None
class BasePersonItem(DjangoItem):