[1.6.x] Removed relative usage of import_module
Python 3 version of importlib doesn't support this syntax.
Partial backport of fdd7a355bf
. Refs #21335.
This commit is contained in:
parent
e052ada0f6
commit
ec0a3f5085
|
@ -5,7 +5,7 @@ from django.utils.importlib import import_module
|
|||
geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
|
||||
|
||||
try:
|
||||
module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
|
||||
module = import_module('django.contrib.gis.geometry.backend.%s' % geom_backend)
|
||||
except ImportError:
|
||||
try:
|
||||
module = import_module(geom_backend)
|
||||
|
|
|
@ -96,7 +96,7 @@ class AppCache(object):
|
|||
self.nesting_level += 1
|
||||
app_module = import_module(app_name)
|
||||
try:
|
||||
models = import_module('.models', app_name)
|
||||
models = import_module('%s.models' % app_name)
|
||||
except ImportError:
|
||||
self.nesting_level -= 1
|
||||
# If the app doesn't have a models module, we can just ignore the
|
||||
|
|
|
@ -110,7 +110,7 @@ class DatabaseErrorWrapper(object):
|
|||
def load_backend(backend_name):
|
||||
# Look for a fully qualified database backend name
|
||||
try:
|
||||
return import_module('.base', backend_name)
|
||||
return import_module('%s.base' % backend_name)
|
||||
except ImportError as e_user:
|
||||
# The database backend wasn't found. Display a helpful error message
|
||||
# listing all possible (built-in) database backends.
|
||||
|
|
|
@ -54,7 +54,7 @@ def iter_format_modules(lang):
|
|||
for location in format_locations:
|
||||
for loc in locales:
|
||||
try:
|
||||
yield import_module('.formats', location % loc)
|
||||
yield import_module('%s.formats' % (location % loc))
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue