Ticket #15286: 15286.diff

File 15286.diff, 903 bytes (added by claudep, 5 years ago)

Don't show PendingDeprecationWarning if path is in LOCALE_PATHS

  • django/utils/translation/__init__.py

    diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py
    index e44b556..a1c8995 100644
    a b class Trans(object): 
    4646                import warnings
    4747                parts = settings.SETTINGS_MODULE.split('.')
    4848                project = import_module(parts[0])
    49                 if path.isdir(path.join(path.dirname(project.__file__), 'locale')):
     49                project_locale_path = path.normpath(path.join(path.dirname(project.__file__), 'locale'))
     50                if path.isdir(project_locale_path) and not project_locale_path in settings.LOCALE_PATHS:
    5051                    warnings.warn(
    5152                        "Translations in the project directory aren't supported anymore. Use the LOCALE_PATHS setting instead.",
    5253                        PendingDeprecationWarning
Back to Top