Django

Code

Changeset 7721

Show
Ignore:
Timestamp:
06/21/08 15:55:17 (5 months ago)
Author:
lukeplant
Message:

Added tests for corner case with deleting where objects are deleted in the wrong order.

These tests currently fail, by design, fix will be committed shortly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/loading.py

    r7679 r7721  
    33from django.conf import settings 
    44from django.core.exceptions import ImproperlyConfigured 
     5from django.utils.datastructures import SortedDict 
     6 
    57import sys 
    68import os 
     
    1921    __shared_state = dict( 
    2022        # Keys of app_store are the model modules for each application. 
    21         app_store = {}
     23        app_store = SortedDict()
    2224 
    2325        # Mapping of app_labels to a dictionary of model names to model code. 
    24         app_models = {}
     26        app_models = SortedDict()
    2527 
    2628        # Mapping of app_labels to errors raised when trying to import the app. 
     
    134136        self._populate() 
    135137        if app_mod: 
    136             return self.app_models.get(app_mod.__name__.split('.')[-2], {}).values() 
     138            return self.app_models.get(app_mod.__name__.split('.')[-2], SortedDict()).values() 
    137139        else: 
    138140            model_list = [] 
     
    150152        if seed_cache: 
    151153            self._populate() 
    152         return self.app_models.get(app_label, {}).get(model_name.lower()) 
     154        return self.app_models.get(app_label, SortedDict()).get(model_name.lower()) 
    153155 
    154156    def register_models(self, app_label, *models): 
     
    160162            # in the app_models dictionary 
    161163            model_name = model._meta.object_name.lower() 
    162             model_dict = self.app_models.setdefault(app_label, {}
     164            model_dict = self.app_models.setdefault(app_label, SortedDict()
    163165            if model_name in model_dict: 
    164166                # The same model may be imported via different paths (e.g.