From 23142eea85c66bfd2cdade016054ed162ea0fa63 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 2 Apr 2017 20:14:39 +0200 Subject: Fixed #18394 -- Added error for invalid JavaScriptCatalog packages Thanks Tim Graham for the review. --- django/views/i18n.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'django') diff --git a/django/views/i18n.py b/django/views/i18n.py index 9edf83e857..9a16a78368 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -232,6 +232,11 @@ class JavaScriptCatalog(View): def get_paths(self, packages): allowable_packages = {app_config.name: app_config for app_config in apps.get_app_configs()} app_configs = [allowable_packages[p] for p in packages if p in allowable_packages] + if len(app_configs) < len(packages): + excluded = [p for p in packages if p not in allowable_packages] + raise ValueError( + 'Invalid package(s) provided to JavaScriptCatalog: %s' % ','.join(excluded) + ) # paths of requested packages return [os.path.join(app.path, 'locale') for app in app_configs] -- cgit v1.3