Optimization request - give ``request.session`` lazy read

2012-09-30 Thread Yo-Yo Ma
With ``contrib.sessions`` installed and ``SessionMiddleware`` in use, I 
noticed that when Django session cookie is set the ``django_session`` table 
is queried on every request, regardless of whether any session data is used 
during the request cycle. Making the ``session`` attribute of request a 
lazy object would represent an optimization in the following 2 cases, both 
of which are the same, in effect:

1) User logs in to perform login-required tasks, then visits pages that 
don't require login
2) User logs in to perform login-required tasks, logs out, then visits 
pages that don't require login

Would this sort of change be backward-incompatible?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/uXBhKovPew4J.
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.



Re: Feature request: collectstatic shouldn't recopy files that already exist in destination

2012-09-30 Thread Stephen Burrows
I use S3 as well, and I have seen cases where files get copied that I know 
don't need to be. That being said, it was never so slow that it was an 
issue for me. Is there clear evidence that this is something which can't be 
handled by the S3 backend due to an inadequate API on the django side?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/D9eemazwQUQJ.
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.



Re: django.test.client.Client tests in Django development?

2012-09-30 Thread Łukasz Rekucki
Hi everyone,

After a quick peekat the code in get_user(), I'm curious is there any
reason we currently don't flush the user's session (or at least remove
the SESSION_KEY and BACKEND_SESSION_KEY) if the backend returns None
for the user's id?

I can't see how being able to hang on to an unauthorized session in
hope it will become authorized again can be anything but a bug.

Regards,
Łukasz Rekucki

-- 
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.



Re: django.test.client.Client tests in Django development?

2012-09-30 Thread Aymeric Augustin
Le 30 sept. 2012 à 10:57, Mateusz Haligowski  a écrit :

> I wanted to contribute to Django and decided to fix #18998. Starting with 
> writing tests, is seems to me that the easiest to write and read the test 
> would be using django.test.client.Client tool (sessions and stuff). Is it OK 
> to use that in testing contrib modules? If not, what is the suggested way?

Hi Mateusz,

Yes, using a django.test.TestCase and the test client is the recommended way to 
write integration tests.

For this ticket, you may find it more convenient to test auth.login() directly. 
It's up to you to find the right level of testing (unit / functional / 
integration).

-- 
Aymeric.

-- 
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.



django.test.client.Client tests in Django development?

2012-09-30 Thread Mateusz Haligowski
Hi,
I wanted to contribute to Django and decided to fix 
#18998. 
Starting with writing tests, is seems to me that the easiest to write and 
read the test would be using django.test.client.Client tool (sessions and 
stuff). Is it OK to use that in testing contrib modules? If not, what is 
the suggested way?

Best Regards,
Mateusz Haligowsk

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/xZzCGOXDo6gJ.
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.