Commit 2c56c1b9 authored by Michal Čihař's avatar Michal Čihař

Simplify import code

parent cc657a61
...@@ -24,8 +24,7 @@ from django.core.exceptions import ImproperlyConfigured ...@@ -24,8 +24,7 @@ from django.core.exceptions import ImproperlyConfigured
# Initialize checks list # Initialize checks list
CHECKS = {} CHECKS = {}
for path in appsettings.CHECK_LIST: for path in appsettings.CHECK_LIST:
i = path.rfind('.') module, attr = path.rsplit('.', 1)
module, attr = path[:i], path[i + 1:]
try: try:
mod = __import__(module, {}, {}, [attr]) mod = __import__(module, {}, {}, [attr])
except ImportError as e: except ImportError as e:
......
...@@ -24,8 +24,7 @@ from django.core.exceptions import ImproperlyConfigured ...@@ -24,8 +24,7 @@ from django.core.exceptions import ImproperlyConfigured
# Initialize checks list # Initialize checks list
SERVICES = {} SERVICES = {}
for path in appsettings.MACHINE_TRANSLATION_SERVICES: for path in appsettings.MACHINE_TRANSLATION_SERVICES:
i = path.rfind('.') module, attr = path.rsplit('.', 1)
module, attr = path[:i], path[i + 1:]
try: try:
mod = __import__(module, {}, {}, [attr]) mod = __import__(module, {}, {}, [attr])
except ImportError as e: except ImportError as e:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment