Ticket #22195: check-constants.diff

File check-constants.diff, 4.0 KB (added by Elvard, 13 months ago)

Added constants for check tags.

  • django/contrib/admin/apps.py

    diff --git a/django/contrib/admin/apps.py b/django/contrib/admin/apps.py
    index a1f4042..3b4f1a3 100644
    a b class SimpleAdminConfig(AppConfig): 
    1111    verbose_name = _("Administration")
    1212
    1313    def ready(self):
    14         checks.register('admin')(check_admin_app)
     14        checks.register(checks.Tags.admin)(check_admin_app)
    1515
    1616
    1717class AdminConfig(SimpleAdminConfig):
  • django/contrib/auth/apps.py

    diff --git a/django/contrib/auth/apps.py b/django/contrib/auth/apps.py
    index f0e169c..254a73d 100644
    a b class AuthConfig(AppConfig): 
    1010    verbose_name = _("Authentication and Authorization")
    1111
    1212    def ready(self):
    13         checks.register('models')(check_user_model)
     13        checks.register(checks.Tags.models)(check_user_model)
  • django/contrib/contenttypes/apps.py

    diff --git a/django/contrib/contenttypes/apps.py b/django/contrib/contenttypes/apps.py
    index fbe4fcc..0462e31 100644
    a b class ContentTypesConfig(AppConfig): 
    99    verbose_name = _("Content Types")
    1010
    1111    def ready(self):
    12         checks.register('models')(check_generic_foreign_keys)
     12        checks.register(checks.Tags.models)(check_generic_foreign_keys)
  • django/core/checks/__init__.py

    diff --git a/django/core/checks/__init__.py b/django/core/checks/__init__.py
    index 82a3acf..8983fa7 100644
    a b from __future__ import unicode_literals 
    44from .messages import (CheckMessage,
    55        Debug, Info, Warning, Error, Critical,
    66        DEBUG, INFO, WARNING, ERROR, CRITICAL)
    7 from .registry import register, run_checks, tag_exists
     7from .registry import register, run_checks, tag_exists, Tags
    88
    99# Import these to force registration of checks
    1010import django.core.checks.compatibility.django_1_6_0  # NOQA
    __all__ = [ 
    1414    'CheckMessage',
    1515    'Debug', 'Info', 'Warning', 'Error', 'Critical',
    1616    'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL',
    17     'register', 'run_checks', 'tag_exists',
     17    'register', 'run_checks', 'tag_exists', 'Tags'
    1818]
  • django/core/checks/compatibility/django_1_6_0.py

    diff --git a/django/core/checks/compatibility/django_1_6_0.py b/django/core/checks/compatibility/django_1_6_0.py
    index 06fb113..a805053 100644
    a b from __future__ import unicode_literals 
    33
    44from django.apps import apps
    55
    6 from .. import Warning, register
     6from .. import Warning, register, Tags
    77
    88
    9 @register('compatibility')
     9@register(Tags.compatibility)
    1010def check_1_6_compatibility(**kwargs):
    1111    errors = []
    1212    errors.extend(_check_test_runner(**kwargs))
  • django/core/checks/model_checks.py

    diff --git a/django/core/checks/model_checks.py b/django/core/checks/model_checks.py
    index 46e5c6f..3f5a36b 100644
    a b import types 
    66
    77from django.apps import apps
    88
    9 from . import Error, register
     9from . import Error, Tags, register
    1010
    1111
    12 @register('models')
     12@register(Tags.models)
    1313def check_all_models(app_configs=None, **kwargs):
    1414    errors = [model.check(**kwargs)
    1515        for model in apps.get_models()
    def check_all_models(app_configs=None, **kwargs): 
    1717    return list(chain(*errors))
    1818
    1919
    20 @register('models', 'signals')
     20@register(Tags.models, Tags.signals)
    2121def check_model_signals(app_configs=None, **kwargs):
    2222    """Ensure lazily referenced model signals senders are installed."""
    2323    from django.db import models
  • django/core/checks/registry.py

    diff --git a/django/core/checks/registry.py b/django/core/checks/registry.py
    index 21efbf3..6a656a1 100644
    a b from itertools import chain 
    66from django.utils.itercompat import is_iterable
    77
    88
     9class Tags(object):
     10    """
     11    Built-in tags for internal checks.
     12
     13    """
     14    admin = 'admin'
     15    compatibility = 'compatibility'
     16    models = 'models'
     17    signals = 'signals'
     18
     19
    920class CheckRegistry(object):
    1021
    1122    def __init__(self):
Back to Top