On Feb 12, 5:54 am, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
wrote:
> On Thu, Feb 11, 2010 at 16:29, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > Please, go back to the beginning of the thread. ;-)
>
> I didn't understand. What if you can't change Apache configuration to
> enable stdout?

You don't need to change the Apache configuration you can remap it in
the WSGI script file.

Also Apache/mod_wsgi does implement sys.stdout functionality, it is
just disabled by default to try and encourage people to write portable
code so you don't get these problems like when deploying to GAE.

If you read far enough down in that referenced article it says:

"""Anyway, because of all the contention arising over all of this, in
mod_wsgi 3.0 I will be giving up and will be making the restrictions
off by default. If you want to write non portable WSGI application,
you can quite happily do so. If you do care about portable WSGI
application code, then you will be able to optionally reenable the
restriction using the same directives above.""

In other words, use mod_wsgi 3.X and you don't have to care as have
given up trying to convince lazy programmers to do the right thing.

As such, web2py should not do anything special for mod_wsgi and in
some respects shouldn't for GAE even.

Graham

> > On Feb 11, 12:25 pm, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
> > wrote:
> >> On Thu, Feb 11, 2010 at 16:10, mdipierro <mdipie...@cs.depaul.edu> wrote:
> >> > When you call print it sends it to stdout and that is redirect into
> >> > the text of the response so it break pages.
>
> >> Using print running web2py on Apache cause exceptions since mod_wsgi
> >> does not implement sys.stdout.
> >> So I think we need to focus this solution in solving the problem with
> >> mod_wsgi instead of only 'adding a new fetaure to GAE'.
>
> >> > On Feb 11, 12:01 am, Graham Dumpleton <graham.dumple...@gmail.com>
> >> > wrote:
> >> >> What is the actual problem you are trying to solve on GAE?
>
> >> >> Graham
>
> >> >> On Feb 11, 4:20 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> >> >> > I agree. I was proposing an idea more than an implementation. The
> >> >> > methods are not that many anyway and most of them do nothing (like
> >> >> > read())
>
> >> >> > >>> import sys
> >> >> > >>> dir(sys.stdout)
>
> >> >> > ['__class__', '__delattr__', '__doc__', '__enter__', '__exit__',
> >> >> > '__getattribute__', '__hash__', '__init__', '__iter__', '__new__',
> >> >> > '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
> >> >> > 'close', 'closed', 'encoding', 'fileno', 'flush', 'isatty', 'mode',
> >> >> > 'name', 'newlines', 'next', 'read', 'readinto', 'readline',
> >> >> > 'readlines', 'seek', 'softspace', 'tell', 'truncate', 'write',
> >> >> > 'writelines', 'xreadlines']
>
> >> >> > On Feb 10, 10:19 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> >> >> > wrote:
>
> >> >> > > On Feb 11, 12:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> >> >> > > > One of my collaborators pointed me to this.
>
> >> >> > > >http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output...
>
> >> >> > > > What about this solution that would also address the issue on GAE?
>
> >> >> > > > class Logger:
> >> >> > > >     def write(self,data):
> >> >> > > >          logging.info(data)
> >> >> > > > sys.stdout = Logger()
>
> >> >> > > Not sufficient as there are lots of methods that a file like object
> >> >> > > should have and which all manner of software for whatever reason 
> >> >> > > like
> >> >> > > to try and use.
>
> >> >> > > One could implement a sys.stdout replacement, but that above is way 
> >> >> > > to
> >> >> > > simplistic.
>
> >> >> > > Graham
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "web2py-users" group.
> >> > To post to this group, send email to web...@googlegroups.com.
> >> > To unsubscribe from this group, send email to 
> >> > web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> >> --
> >> Álvaro Justen - Turicas
> >>  http://blog.justen.eng.br/
> >>  21 9898-0141
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to