#10381: Test failure caused by r9921
------------------------------------+---------------------------------------
Reporter: mtredinnick | Owner: russellm
Status: new | Milestone:
Component: Uncategorized | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by russellm):
Granted, SortedDict isn't free, but the overhead isn't particularly
expensive in this particular case. Worst case, you have a dictionary with
as many keys as you have apps. It's also transient storage - it only
exists for the duration of the dumpdata command call. This isn't an area
where we have to be especially paranoid about efficiency.
There is also a minor advantage to maintaining the order (aside from
making the tests work) - the apps will be serialized in the order that
they are specified on the command line.
Just replacing the comparison with a == isn't a simple solution here - the
output is a serialized JSON string, not just a list of dicts; also, the
outer structure is a list, so the order is significant on comparison (not
in a particularly meaningful way in this case, but it would still defeat
any simple parsed JSON comparison)
One alternate approach would be to serialize apps in the same order the
occur in the INSTALLED_APPS setting. This would yield a predictable
iteration order at the cost of a marginally more CPU intensive approach to
developing the iteration list. Personally, I'm comfortable with the cost
of the SortedDict approach in this case, but I'm happy to use
INSTALLED_APPS order too. Let me know which one you would prefer and I'll
commit.
--
Ticket URL: <http://code.djangoproject.com/ticket/10381#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---