Changeset 3202
- Timestamp:
- 06/25/06 09:49:34 (2 years ago)
- Files:
-
- django/trunk/django/db/models/loading.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/loading.py
r3201 r3202 3 3 from django.conf import settings 4 4 from django.core.exceptions import ImproperlyConfigured 5 import sys 6 import os 5 7 6 8 __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models') … … 92 94 model_name = model._meta.object_name.lower() 93 95 model_dict = _app_models.setdefault(app_label, {}) 96 if model_dict.has_key(model_name): 97 # The same model may be imported via different paths (e.g. 98 # appname.models and project.appname.models). We use the source 99 # filename as a means to detect identity. 100 fname1 = os.path.normpath(sys.modules[model.__module__].__file__) 101 fname2 = os.path.normpath(sys.modules[model_dict[model_name].__module__].__file__) 102 # Since the filename extension could be .py the first time and .pyc 103 # or .pyo the second time, ignore the extension when comparing. 104 if os.path.splitext(fname1)[0] == os.path.splitext(fname2)[0]: 105 continue 94 106 model_dict[model_name] = model
