Skip to content

Commit

Permalink
Merge pull request #2 from mozilla/django-system-check
Browse files Browse the repository at this point in the history
Add Django system check for settings
  • Loading branch information
Ben Dickinson authored Jun 7, 2024
2 parents a2ae6c8 + 062d651 commit cba4feb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/wagtail_localize_smartling/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ class WagtailLocalizeSmartlingAppConfig(AppConfig):
label = "wagtail_localize_smartling"
name = "wagtail_localize_smartling"
verbose_name = "Wagtail Localize Smartling"

def ready(self):
from . import checks, signals # noqa: F401
20 changes: 19 additions & 1 deletion src/wagtail_localize_smartling/checks.py
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# TODO check required settings
from django.core.checks import Error, register
from django.core.exceptions import ImproperlyConfigured

from .settings import settings as smartling_settings


@register()
def smartling_settings_check(app_configs, **kwargs):
errors = []
try:
str(smartling_settings.PROJECT_ID)
except ImproperlyConfigured as e:
errors.append(
Error(
e.args[0],
id="wagtail_localize_smartling.E001",
)
)
return errors

0 comments on commit cba4feb

Please sign in to comment.