[Chicago] help from Django and Pylons developers

Massimo Di Pierro mdipierro at cs.depaul.edu
Mon Apr 28 22:56:23 CEST 2008


There was some confusion. ;-)
Than they are very similar in this respect. Thanks for the  
clarification.

Massimo

On Apr 28, 2008, at 3:41 PM, Cosmin Stejerean wrote:

> On Mon, Apr 28, 2008 at 2:55 PM, Massimo Di Pierro
> <mdipierro at cs.depaul.edu> wrote:
>> Sorry the web2py way is better. Here is the complete code
>>
>>  #in applications/security/controller/default.py
>>  class Jammer():
>>   def read(self,n):  return 'x'*n
>>  def jam():  return response.stream(Jammer())
>>
>>  in #routes.py
>>  routes_in=(('.*(php|PHP|asp|ASP|jsp|JSP)','/security/default/jam'),)
>>
>>  and it does not matter which web server you use.
>>
>>  Massimo
>>
>
> What about web2py is better? I was commenting on a way to serve really
> large files using the performance benefits of something like Apache or
> Nginx (for static files) while still being able to use authentication
> or dynamic generation of the file in Python. Your example just show
> how to send an infinite stream of data to the client. This isn't hard
> to do in Django either.
>
> # in your views.py or somewhere else
>
>
> class Jammer(object):
>   def __iter__(self):
>     while True:
>       yield 'x'
>
> def jam(request):
>   return HttpResponse(Jammer())
>
> #in your urlconf you can put something like
> ('(php|PHP|asp|ASP|jsp|JSP)/$', jam),
>
>
> --
> Cosmin Stejerean
> http://blog.offbytwo.com
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago



More information about the Chicago mailing list