summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-11-17 09:24:56 +0100
committerClaude Paroz <claude@2xlibre.net>2014-11-17 09:24:56 +0100
commit6a05f0dfe3a12fa0dd5e840f0dc5ce6b23158525 (patch)
treed3973c078add14630519e1a26c17aa23b886ab63
parentbb4a92d7845878b2ce0c4a5ca154cb4db22f7bad (diff)
Simplified handle_extensions management utility
makemessages now doesn't need any special ignoring logic, after commit bb4a92d784.
-rw-r--r--django/core/management/commands/makemessages.py2
-rw-r--r--django/core/management/templates.py3
-rw-r--r--django/core/management/utils.py11
3 files changed, 6 insertions, 10 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index ae6b72e946..93add45ca4 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -251,7 +251,7 @@ class Command(BaseCommand):
exts = extensions if extensions else ['js']
else:
exts = extensions if extensions else ['html', 'txt', 'py']
- self.extensions = handle_extensions(exts, ignored=())
+ self.extensions = handle_extensions(exts)
if (locale is None and not exclude and not process_all) or self.domain is None:
raise CommandError("Type '%s help %s' for usage information." % (
diff --git a/django/core/management/templates.py b/django/core/management/templates.py
index d514c84755..d088ca974a 100644
--- a/django/core/management/templates.py
+++ b/django/core/management/templates.py
@@ -85,8 +85,7 @@ class TemplateCommand(BaseCommand):
raise CommandError("Destination directory '%s' does not "
"exist, please create it first." % top_dir)
- extensions = tuple(
- handle_extensions(options['extensions'], ignored=()))
+ extensions = tuple(handle_extensions(options['extensions']))
extra_files = []
for file in options['files']:
extra_files.extend(map(lambda x: x.strip(), file.split(',')))
diff --git a/django/core/management/utils.py b/django/core/management/utils.py
index f9effe7192..7a823424a6 100644
--- a/django/core/management/utils.py
+++ b/django/core/management/utils.py
@@ -32,19 +32,16 @@ def popen_wrapper(args, os_err_exc_type=CommandError):
)
-def handle_extensions(extensions=('html',), ignored=('py',)):
+def handle_extensions(extensions):
"""
Organizes multiple extensions that are separated with commas or passed by
- using --extension/-e multiple times. Note that the .py extension is ignored
- here because of the way non-*.py files are handled in make_messages() (they
- are copied to file.ext.py files to trick xgettext to parse them as Python
- files).
+ using --extension/-e multiple times.
For example: running 'django-admin makemessages -e js,txt -e xhtml -a'
would result in an extension list: ['.js', '.txt', '.xhtml']
>>> handle_extensions(['.html', 'html,js,py,py,py,.py', 'py,.py'])
- {'.html', '.js'}
+ {'.html', '.js', '.py'}
>>> handle_extensions(['.html, txt,.tpl'])
{'.html', '.tpl', '.txt'}
"""
@@ -54,7 +51,7 @@ def handle_extensions(extensions=('html',), ignored=('py',)):
for i, ext in enumerate(ext_list):
if not ext.startswith('.'):
ext_list[i] = '.%s' % ext_list[i]
- return set(x for x in ext_list if x.strip('.') not in ignored)
+ return set(ext_list)
def find_command(cmd, path=None, pathext=None):