Ticket #6961: patch2.txt

File patch2.txt, 916 bytes (added by Michael Malone, 15 years ago)

Patch that checks whether models module is a package by checking for path attribute

Line 
1Index: django/core/management/commands/loaddata.py
2===================================================================
3--- django/core/management/commands/loaddata.py (revision 9800)
4+++ django/core/management/commands/loaddata.py (working copy)
5@@ -76,7 +76,15 @@
6 if has_bz2:
7 compression_types['bz2'] = bz2.BZ2File
8
9- app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
10+ app_module_paths = []
11+ for app in get_apps():
12+ if hasattr(app, '__path__'):
13+ for path in app.__path__:
14+ app_module_paths.append(path)
15+ else:
16+ app_module_paths.append(app.__file__)
17+
18+ app_fixtures = [os.path.join(os.path.dirname(path), 'fixtures') for path in app_module_paths]
19 for fixture_label in fixture_labels:
20 parts = fixture_label.split('.')
21
Back to Top