Ticket #12846: bytecode_loader.diff

File bytecode_loader.diff, 739 bytes (added by echos, 3 years ago)
  • django/core/management/__init__.py

    diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
    index 8e83304..0bd8446 100644
    a b  
    11import collections
     2import fnmatch
    23import os
    34import sys
    45from optparse import OptionParser, NO_DEFAULT
    def find_commands(management_dir): 
    2526    """
    2627    command_dir = os.path.join(management_dir, 'commands')
    2728    try:
    28         return [f[:-3] for f in os.listdir(command_dir)
    29                 if not f.startswith('_') and f.endswith('.py')]
     29        return [os.path.splitext(f)[0] for f in fnmatch.filter(
     30                os.listdir(command_dir), '[!_]*.py[co]')]
    3031    except OSError:
    3132        return []
    3233
Back to Top