-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
121 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ db/db1.bz2 | |
.venv | ||
docker/cache | ||
src/etools_datamart/apps/core/static/api-doc.css.map | ||
docker/superset.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
1.1 | ||
--- | ||
* Fixes wrong import in middleware | ||
|
||
1.0 | ||
--- | ||
* SystemFilters. Ability to force per user/service filters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
NAME = 'etools-datamart' | ||
VERSION = __version__ = '1.0' | ||
VERSION = __version__ = '1.1' | ||
__author__ = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.apps import AppConfig | ||
|
||
|
||
class Config(AppConfig): | ||
name = 'etools_datamart.apps.init' | ||
|
||
def ready(self): | ||
from . import checks # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import importlib | ||
import pkgutil | ||
|
||
from django.core.checks import Error, register | ||
|
||
|
||
def check_imports(): | ||
import etools_datamart as package | ||
"" | ||
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__): | ||
current_module = '{}.{}'.format(package.__name__, modname) | ||
m = importlib.import_module(current_module) | ||
if hasattr(m, '__path__'): | ||
for _, sub_mod, __ in pkgutil.iter_modules(m.__path__): | ||
sub_module = '{}.{}'.format(current_module, sub_mod) | ||
sm = importlib.import_module(sub_module) | ||
if hasattr(sm, '__path__'): | ||
for _, s_sub_mod, __ in pkgutil.iter_modules(sm.__path__): | ||
s_sub_mod = '{}.{}.{}'.format(current_module, sub_mod, s_sub_mod) | ||
try: | ||
importlib.import_module(s_sub_mod) | ||
except Exception as e: | ||
raise Exception(f"""Error importing '{s_sub_mod}'. | ||
{e} | ||
""") | ||
|
||
|
||
@register(deploy=True) | ||
def check_importable(app_configs, **kwargs): | ||
errors = [] | ||
try: | ||
check_imports() | ||
except Exception as e: | ||
errors.append( | ||
Error( | ||
str(e), | ||
hint='A hint.', | ||
obj=None, | ||
id='datamart.E001', | ||
) | ||
) | ||
return errors |
28 changes: 28 additions & 0 deletions
28
src/etools_datamart/apps/init/management/commands/check-deps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from django.core.management.base import BaseCommand, CommandError | ||
|
||
from etools_datamart.apps.init.checks import check_imports | ||
|
||
|
||
class Command(BaseCommand): | ||
args = '' | ||
help = 'Imports all modules to check for missed dependencies.' | ||
requires_migrations_checks = False | ||
requires_system_checks = False | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(Command, self).__init__(*args, **kwargs) | ||
|
||
def add_arguments(self, parser): | ||
super(Command, self).add_arguments(parser) | ||
|
||
def _get_cursor(self, conn): | ||
conn.cursor() | ||
return conn | ||
|
||
def handle(self, *args, **options): | ||
try: | ||
check_imports() | ||
except Exception as e: | ||
raise CommandError(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters