Ticket #19048: django_core_management_find_management_module.patch
File django_core_management_find_management_module.patch, 1.0 KB (added by , 12 years ago) |
---|
-
django/core/management/__init__.py
a b def find_management_module(app_name): 44 44 parts.reverse() 45 45 part = parts.pop() 46 46 path = None 47 paths = [] 47 48 48 49 # When using manage.py, the project module is added to the path, 49 50 # loaded, then removed from the path. This means that … … def find_management_module(app_name): 60 61 if f: 61 62 f.close() 62 63 64 paths.append(path) 65 66 for sys_path in sys.path: 67 try: 68 f, path, descr = imp.find_module(part, [sys_path]) 69 except ImportError: 70 pass 71 else: 72 if f: 73 f.close() 74 if path not in paths: 75 paths.append(path) 76 63 77 while parts: 64 78 part = parts.pop() 65 f, path, descr = imp.find_module(part, path and [path] or None) 79 f, path, descr = imp.find_module(part, paths or None) 80 paths.append(path) 66 81 if f: 67 82 f.close() 68 83 return path