Le 18 mai 2012 à 11:51, Tom Evans <tevans...@googlemail.com> a écrit :
> On Wed, May 16, 2012 at 4:38 PM, Aymeric Augustin > <aymeric.augus...@polytechnique.org> wrote: >> 2012/5/16 Tom Evans <tevans...@googlemail.com>: >>> So, is the session key being available part of the API, or is relying >>> on the session key existing incorrect? >> >> Hi Tom, >> >> Accessing the session key before saving the session is incorrect. >> > > Accessing the session key before saving the session is incorrect, but > there is nothing in the session API to determine if a session is > saved. if session.session_key == None: ... > I don't see a good way to support 1.3 and 1.4 or in 1.3 to work around the > bug that this fixes If I understand correctly, you're writing a pluggable app and you want to make it compatible with Django 1.3 and 1.4. You didn't know this bug existed in 1.3, so I don't understand your sudden urge to work around it in your application. Just keep your current code as is and if your users complain, show them that it's a bug in Django and tell them that they should upgrade. > without explicitly saving the session > object each time prior to accessing the session key, which is not a > particularly clever way of doing things. This API needs to be looked at. The following sounds perfectly simple and reasonable to me: if session.session_key == None: session.save() The if clause will match only under Django 1.4, since under 1.3 session_key isn't None when it should. So you support automatically both versions. I'm sorry, but it's hard to read your criticism in a constructive way when the solution is obvious and doesn't need any changes in Django's APIs. You raised several related points in your next email; could you create tickets on Trac so we can verify and fix these issues? Thanks! -- Aymeric (mobile). -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.