Re: GZipMiddleWare documentation

2013-08-10 Thread Aymeric Augustin
On 10 août 2013, at 05:09, Russell Keith-Magee  wrote:

> I also have a nagging feeling in the back of my head that there have been 
> questions raised about whether GZIPMiddleware should exist *at all* -- that 
> there's some niggling detail in the WSGI spec that says that GZip compression 
> should be applied at the web server level, not the WSGI level. Can anyone 
> confirm if I'm hallucinating on this point?

I was under the same impression, but after double-checking the PEP, I don't 
think it forbids content encoding at the application level. (It does forbid 
transport encoding, for example chunking.)

>From http://www.python.org/dev/peps/pep-0333/#other-http-features:
> the application should use a suitable content encoding on its own, and must 
> not apply a transport encoding.


Content encoding likely refers to the Content-Encoding HTTP header, which is 
used for delivering gzipped content.


> And if I'm not, perhaps we should just be deprecating GZipMiddlware?

At this point, there's a good practical reason for keeping it.

1) There are valid use cases for generating ETags at the application level, 
typically one may save CPU by doing something smarter than a hash of the final 
response.

2) Nginx is a common deployment platform and it strips ETags when gzipping 
content on the fly. As usual with nginx, documentation is sparse, but this 
thread explains the problem: 
http://mailman.nginx.org/pipermail/nginx/2013-June/039319.html

As a consequence, if we want to support ETags, Gzip and nginx, we have to 
provide compression at the application level.

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Re: GZipMiddleWare documentation

2013-08-10 Thread Daniele Procida
On Sat, Aug 10, 2013, Russell Keith-Magee  wrote:

>I also have a nagging feeling in the back of my head that there have been
>questions raised about whether GZIPMiddleware should exist *at all* -- that
>there's some niggling detail in the WSGI spec that says that GZip
>compression should be applied at the web server level, not the WSGI level.
>Can anyone confirm if I'm hallucinating on this point? And if I'm not,
>perhaps we should just be deprecating GZipMiddlware?

There is this discussion:  which 
concludes that it shouldn't be deprecated because some versions of nginx 
( don't work with Etags 
and GZip as expected otherwise).

If that's because nginx doesn't behave properly, and the only reason for not 
deprecating it, then perhaps it should be renamed 
"GZipForMisbehavingBrowsersMiddleware".

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Merging Schema Alteration branch

2013-08-10 Thread Florian Apolloner
On Saturday, August 10, 2013 4:41:28 AM UTC+2, Russell Keith-Magee wrote: 
>
> Say… Andrew… there's this guy on a black horse at my front door… says his 
> name is "Famine"… he wants to talk about the coming apocalypse… :-)
>

Indeed, I already got migrations which magically unapply themself everytime 
I try to apply them, good thing that's not a production db ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Re: GZipMiddleWare documentation

2013-08-10 Thread Florian Apolloner
Hi,

On Saturday, August 10, 2013 9:54:02 AM UTC+2, Daniele Procida wrote:
>
> There is this discussion:  
> which concludes that it shouldn't be deprecated because some versions of 
> nginx ( don't work 
> with Etags and GZip as expected otherwise). 
>
> If that's because nginx doesn't behave properly, and the only reason for 
> not deprecating it, then perhaps it should be renamed 
> "GZipForMisbehavingBrowsersMiddleware". 
>

That might have been the only reason (btw other servers might behave the 
same or have similar, didn't test that myself); but as Donald says, in 
light of BREACH there are new reasons to keep it (at least for now, till we 
know if we want to keep it). Also, renaming things doesn't play well with 
Django's backwards compat policy and java-style 200Char class names are 
ugly, but I am sure you only suggested that as jest ;) 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Passing extra data to validator

2013-08-10 Thread Eric Cheung
It's only able to access a field value in validator but it would be lacked 
if checking request object data. 
Should better to have another parameter for passing data to validators? 
Maybe like this:

form = MyForm(request.POST, validator_data={'user': request.user})

def my_validator(value, validator_data):
user = validator_data.get('user')
# check something 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Performance optimisation documents, ticket 20877

2013-08-10 Thread Daniele Procida


Work in progress; comments appreciated: 


Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Merging Schema Alteration branch

2013-08-10 Thread Andrew Godwin
I'll take a look at those over the next few days, Florian, it's the most
serious bug I've seen for a while!

Big issues like that aside, this is never going to be bug-free at merge - I
want to bring the merge forward a bit to avoid even more bugs being
introduced by master and this branch deviating even more.

Andrew
On 10 Aug 2013 10:22, "Florian Apolloner"  wrote:

> On Saturday, August 10, 2013 4:41:28 AM UTC+2, Russell Keith-Magee wrote:
>>
>> Say… Andrew… there's this guy on a black horse at my front door… says his
>> name is "Famine"… he wants to talk about the coming apocalypse… :-)
>>
>
> Indeed, I already got migrations which magically unapply themself
> everytime I try to apply them, good thing that's not a production db ;)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.