Ticket #10381: 10381-r9921.diff

File 10381-r9921.diff, 1.0 KB (added by Russell Keith-Magee, 16 years ago)

Patch to enforce predictable ordering in dumpdata output

  • django/core/management/commands/dumpdata.py

    diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py
    index eecf940..1f2a2db 100644
    a b  
    11from django.core.exceptions import ImproperlyConfigured
    22from django.core.management.base import BaseCommand, CommandError
    33from django.core import serializers
     4from django.utils.datastructures import SortedDict
    45
    56from optparse import make_option
    67
    class Command(BaseCommand):  
    2728        excluded_apps = [get_app(app_label) for app_label in exclude]
    2829
    2930        if len(app_labels) == 0:
    30             app_list = dict([(app, None) for app in get_apps() if app not in excluded_apps])
     31            app_list = SortedDict([(app, None) for app in get_apps() if app not in excluded_apps])
    3132        else:
    32             app_list = {}
     33            app_list = SortedDict()
    3334            for label in app_labels:
    3435                try:
    3536                    app_label, model_label = label.split('.')
Back to Top