Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-26 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  closed
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by sergeykolosov):

 * cc: sergeykolosov (added)


Comment:

 I would like to make an appeal to core developers: all design decisions
 involving involuntary session creation MUST be made with a great caution.

 In case of a high-load project, avoiding to create a session for non-
 authenticated users is a vital strategy with a critical influence on
 application performance.

 It doesn't really make a big difference, whether you use a database
 backend, or Redis, or whatever else; eventually, your load would be high
 enough, and scaling further would not help anymore, so that either network
 access to the session backend or its “INSERT” performance would become a
 bottleneck.

 In my case, it's an application with 20-25 ms response time under a
 2-3 RPM load.
 Having to create a session for an each session-less request would be
 critical enough to decide not to upgrade Django, or to fork and rewrite
 the corresponding components.

 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.cb2df610e1eefcaa5b21b6127d293349%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-12 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  closed
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Claude Paroz ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"9922ed46e2e81845006792310f3f1a3bf0d7b2a6"]:
 {{{
 #!CommitTicketReference repository=""
 revision="9922ed46e2e81845006792310f3f1a3bf0d7b2a6"
 Fixed #21473 -- Limited language preservation to logout

 Current language is no longer saved to session by LocaleMiddleware
 on  every response (the behavior introduced in #14825).
 Instead language stored in session is reintroduced into new session
 after logout.

 Forward port of c558a43fd6 to master.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.9ee03899dbe88ece3c33c91f4848d69c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-12 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by ludwik):

 I think it looks perfect.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.7c45809d2308d3c6733720a280832199%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-12 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 Ludwik, mind having a look at the attached patch?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.2aaa189af2ea72ee24797d1ce8ea6931%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-11 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by ludwik):

 Replying to [comment:11 claudep]:
 > I don't think so, `test_backwards_session_language` is testing that even
 with old `django_language` cookie name, the language is still kept in the
 session (with the new `_language` cookie name). However, I admit this is
 going very far, and I wouldn't oppose to simply removing that test.

 You are right, sorry. I got confused by the method description, which
 turns out to be pretty poor (or maybe it's just me not being a native
 speaker?). Anyhow. This tests something more specific, but it still just
 tests a specific part of the behavior that is being removed. More
 importantly this tests requires a behavior that is entirely unnecessary.
 There is already
 
[https://github.com/django/django/blob/master/django/utils/translation/trans_real.py#L483
 code for backward compatybility with `django_language` session key in
 django.utils.translations]. There is no point for the locale middleware to
 get involved and additionaly rename the key on the fly. I'd say you should
 just remove the test.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.0906d68472a411547c55ef60d10679cd%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-11 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  master
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by claudep):

 * status:  closed => new
 * version:  1.6 => master
 * resolution:  fixed =>
 * stage:  Ready for checkin => Accepted


Comment:

 Reopening until fixed in master.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.260873bf9e4556bfefaad309c24ec782%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-11 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:   |  Version:  1.6
  Internationalization   |   Resolution:  fixed
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Claude Paroz ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"c558a43fd6bbcea9972b66965f7e8619bc247df1"]:
 {{{
 #!CommitTicketReference repository=""
 revision="c558a43fd6bbcea9972b66965f7e8619bc247df1"
 [1.6.x] Fixed #21473 -- Limited language preservation to logout

 Current language is no longer saved to session by LocaleMiddleware
 on  every response (the behavior introduced in #14825).
 Instead language stored in session is reintroduced into new session
 after logout.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.40f611c8260aa2ff5f84cd4d19afb0f4%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-10 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by claudep):

 I don't think so, `test_backwards_session_language` is testing that even
 with old `django_language` cookie name, the language is still kept in the
 session (with the new `_language` cookie name). However, I admit this is
 going very far, and I wouldn't oppose to simply removing that test.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.9bbbd05ccc726b8666893cfd418d3e2b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-10 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by ludwik):

 `i18n.LocaleMiddlewareTests.test_backwards_session_language` "checks that
 language is stored in session if missing". I believe that means that it
 tests for the behavior that was explicitly deemed undesirable (or at least
 this ticket postulates it is undesirable) - the whole point of this ticket
 is we don't want a missing language to be automatically add to session. So
 I believe the test should be simply removed and replaced with
 `i18n.LocaleMiddlewareTests.test_language_not_saved_to_session`. The
 latter tests for a behavior that is the exact opposite of the behavior
 expected by `i18n.LocaleMiddlewareTests.test_backwards_session_language`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.e3d0f6085cecc8bef7f4fb82f36ca690%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-10 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by claudep):

 I admit I'm struggling porting the patch to master, especially with the
 `i18n.LocaleMiddlewareTests.test_backwards_session_language` test.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.8b70e92e53cce7d165a0b7638c3fecc1%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-09 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by anonymous):

 I really hope Django adopts behaviour described in #12794 or #15902. It
 will make my life much easier, because the current behaviour is not really
 compatible with solutions like Varnish, which prevents me from using the
 built-in @set_language@ view.
 However this bigger change surely won't happen in the stable 1.6.x branch,
 so my patch for this branch still stands.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.5b9fdee7b2c2a3f9d0b5d3a5b3c45d10%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-07 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by ramiro):

 See also #12794 and #15902.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.dad1e3a446d1b2cb045ab14c2ff0f281%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-12-07 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Release blocker  | Triage Stage:  Ready for
 Keywords:   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by claudep):

 * stage:  Accepted => Ready for checkin


Comment:

 Patch looks good (and tests pass).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.b667d4d5f5c9d6f00811bdc789b6e919%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-11-21 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  1.6
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by ludwik):

 * has_patch:  0 => 1


Comment:

 I created a code for a possible fix. It's in my `ticket_21473_1_6` topic
 branch here: https://github.com/ludwiktrammer/django/tree/ticket_21473_1_6

 This only work on stable/1.6.x branch and won't work on master. I will
 create a separate version for master, provided this looks ok.

 Tests are included.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.663df8999db2fdf9fba1bf8bfff51a43%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-11-20 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  1.6
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 I'm fine with proposal #1.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.ca9e1ae37367908b46c337deaa196ffc%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-11-20 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  1.6
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by akaariai):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 The solution in #14825 seems a bit over-aggressive. The implementation in
 there is "force-assign language back to session for each response". For
 example this means it is impossible to force-clear the session language if
 you actually want that. And it also means that the language is stored in
 the session no matter if you actually want to use session to store the
 language. As session language overrides cookie language this essentially
 breaks cookie based language selection. This will also break a view that
 does this:
 {{{
 def change_language(request, lang):
 request.session['django_language'] = lang
 return HttpResponseRedirect(somepage)
 }}}
 Some proposals for fix:
   1. Assign the language back to session in contrib.auth.logout() right
 after session.flush(). Revert the change to localemiddleware
   2. In LocaleMiddleware, store the language back only if it came from
 session. This can be done by setting request._language_was_from_session =
 True in process_request and checking against that in process_response.
   3. Just revert the change.

 I don't particularly like the idea that you can't flush the language code
 from session, and with option 2 above it will be force-restored on
 process_response. So, I vote for approach 1. This means that
 session.flush() will remove the language for next request. But if you
 store the language in a session and then flush it, isn't that what is
 supposed to happen?

 I haven't actually ran any tests to verify this issue but the analysis in
 the description are convincing enough for me. Marking this as release
 blocker as this is a regression in 1.6.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.fdfc80656b32690fe84e1eb56955155e%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-11-20 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by ludwik):

 Maybe behaviour requested by #14825 could by a setting, so it stops
 breaking backward compatibility?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.7e865d6b4eb431eceda4ac76416dd616%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21473: Cookie based language detection no longer practical

2013-11-20 Thread Django
#21473: Cookie based language detection no longer practical
-+-
 Reporter:  ludwik   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  1.6
  Internationalization   |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by ludwik):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 The change was caused by #14825.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.69204d551eb2ec407a2d42845bb2%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Django] #21473: Cookie based language detection no longer practical

2013-11-20 Thread Django
#21473: Cookie based language detection no longer practical
--+
 Reporter:  ludwik|  Owner:  nobody
 Type:  Bug   | Status:  new
Component:  Internationalization  |Version:  1.6
 Severity:  Normal|   Keywords:
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 I use cookies to save user's custom language preference (and that's not
 just a matter of personal taste - I use Varnish, so it's important for me
 to defer putting a session cookie on user's computer as long as possible,
 because it is unique per user, so does not work good with caching).

 Up until Django 1.6 I successfully used the following method:

 1. Use Django's `LocaleMiddleware` so the correct locale is detected and
 used.
 2. When user switches languages set a cookie with her new preference, with
 name based on `settings.LANGUAGE_COOKIE_NAME`.

 I think that sounds pretty responsible and in line with what's in
 documentation. And it worked as expected. `LocaleMiddleware` used the
 cookie's value during language detection.

 Unfortunately it all break after upgrading to Django 1.6. In Django 1.6
 the following code was added to `LocaleMiddleware`'s `process_response()`
 method:

 {{{
 # Store language back into session if it is not present
 if hasattr(request, 'session'):
 request.session.setdefault('django_language', language)
 }}}

 It has two unfortunate consequences for me. The former more obvious, the
 latter more important:

 1. Session cookie is now always present on user's computer. A session is
 created as soon a she opens the site for the first time. That's defeats
 the whole purpose of using `django_language` cookie instead of using
 sessions.

 2. When a user opens the site for the first time her current language is
 saved to her session. She haven't had a chance to manually set her
 preference yet, so the value set to session in based on request headers or
 `LANGUAGE_CODE` settings. From now on `django_language` cookie value is
 ignored (and for that matter her changing language preferences in her
 browser is ignored also), because the value from session has the highest
 priority.

 So, to summarise: cookie value is ignored if session value is present, but
 starting from Django 1.6 session value is always present.

 My code broke after upgrading to Django 1.6, just because I used a cookie-
 based method, that is part of documented Django futures. The '''only'''
 way to use cookies for setting language now, is to disable sessions
 completely in your project (not an option for me). That's a really big
 change, and there is literally nothing about it in "backwards incompatible
 changes" section of Django 1.6 release notes. I also don't see an easy
 work around this problem for me.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.df456c537fa6017ee8cd719406b582a8%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.