Commit ec0a3f50 authored by Claude Paroz's avatar Claude Paroz
Browse files

[1.6.x] Removed relative usage of import_module

Python 3 version of importlib doesn't support this syntax.
Partial backport of fdd7a355. Refs #21335.
parent e052ada0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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