On Sun, Nov 9, 2008 at 5:56 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > For 1.1, could we look into unifying the interface to > ``response.context`` to avoid this sort of problem? Unless I'm > thinking about this the wrong way, it shouldn't be too hard to > differentiate dictionary-style access from list-style access, since > the former -- in the case of a Context -- will always be using string > keys and the latter will always be using integer indexes.
No objections to looking at this for v1.1. It's certainly a wart that needs some attention. However, to clarify - are you talking about a backwards incompatible change, or are you talking about putting a backwards compatible layer in place that tries to tell the difference between the two modes of access? The backwards incompatible change is actually trivial - all that is required is to remove the gymnastics that the test code does to turn a list of one context entry into a single standalone entry. This is one of those things that seemed like a really good idea at the time, but which grew old really quickly. I'm very conscious of maintaining backwards compatibility, but this one would be high on the list of things that, with hindsight, I wouldn't mind changing. I can see a number of possible interpretations for the backwards compatible access layer: - Only look in context [0], but as Eric notes, the value you seek won't always be in the first context. - Iterate through all the contexts looking for the first match, and return it - Iterate through all the contexts looking for any matches, and only return if the match is unique Another option would be to duplicate the functionality - maintain request.context as-is, but add a new request.full_context (or some other bikeshed) which preserves the list-nature of the contexts. This does introduce some functional duplication in the API, but it would be backwards compatible. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---
