Thanks all for your help.

I managed to find a small workaround.
Just put a "sys.exit()" after the print statement and all those annoying
'extras' will not surface.

Thanks!

On 31 July 2010 15:43, Tim Hoffman <[email protected]> wrote:

> Hi
>
> I assume you are using webapp ?  Just had a quick look at webapp
> Response object
> and out is in fact a StringIO. So in fact all you need to do in you
> deferred code is actually create a web app Response object
> bind it to self out.  Then once you have finished with it, push the
> string in reponse.out up to you spreadsheet,
>
> T
>
> On Jul 31, 2:25 pm, TohSiang© <[email protected]> wrote:
> > That sounds like it will work.
> > Can you point me in the right direction in creating a fake response
> object?
> >
> > On 31 July 2010 13:49, Tim Hoffman <[email protected]> wrote:
> >
> >
> >
> > > Hi
> >
> > > That helps.
> >
> > > If the user selects deferred then create a fake response object inside
> > > the deferred code where out is a StringIO
> > > then the code can write too .  So that self.response,out.write will
> > > work.
> >
> > > Having said that, response.out.write may not be appropriate for output
> > > to the spreadsheet.
> >
> > > T
> >
> > > On Jul 31, 1:32 pm, TohSiang© <[email protected]> wrote:
> > > > So, what I'm trying to do is to let the user select what "mode" he
> wants
> > > to
> > > > do something in.
> > > > If it is "online" mode, then output to screen and rendered in html.
> > > > If it is "offline" mode, then send to deferred library and have the
> data
> > > > written to google spreadsheets.
> >
> > > > The problem I have is that is I use "self.response.out.write", then
> the
> > > > class would not be picklable for the deferred library.
> >
> > > > On 31 July 2010 12:01, Tim Hoffman <[email protected]> wrote:
> >
> > > > > Use the logger, if  you want some sort of logged output in defer.
> >
> > > > > T
> >
> > > > > On Jul 31, 10:56 am, TohSiang© <[email protected]> wrote:
> > > > > > I'm in a situation where I do not have a suitable "self".
> > > > > > E.g. In a mapper module where I've got a deferred.defer running.
> > > > > > This module isn't a webapp.requesthandler and thus I can't do a
> > > > > > self.response.out.write.
> > > > > > But within my codes, I still need to render something.
> >
> > > > > > (yeah, I know that deferred.defer and render do not actually go
> > > > > together...)
> >
> > > > > > Thanks!
> >
> > > > > > On 31 July 2010 00:03, Geoffrey Spear <[email protected]>
> wrote:
> >
> > > > > > > Don't use print statements.  Your framework will have a way to
> > > write
> > > > > > > to the response (with webapp, self.response.out.write).
> >
> > > > > > > On Jul 30, 11:45 am, TohSiang© <[email protected]> wrote:
> > > > > > > > Can anyone tell me how I can suppress all the "extra"
> information
> > > > > that
> > > > > > > comes
> > > > > > > > with a print statement?
> >
> > > > > > > > Whenever I issue a print command, the following will ALWAYS
> > > appear:
> > > > > > > > *Status: 200 OK*
> > > > > > > > ***Content-Type: text/html; charset=utf-8*
> > > > > > > > ***Cache-Control: no-cache*
> > > > > > > > ***Expires: Fri, 01 Jan 1990 00:00:00 GMT **Content-Length:
> 0*
> > > > > > > > *
> > > > > > > > *
> > > > > > > > It is causing my post-print statements (such as
> template.render)
> > > to
> > > > > screw
> > > > > > > > up.
> > > > > > > > Please help.
> > > > > > > > Thanks.
> >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the
> Google
> > > > > Groups
> > > > > > > "Google App Engine" group.
> > > > > > > To post to this group, send email to
> > > [email protected]
> > > > > .
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib
> [email protected]><google-appengine%2Bunsubscrib
> > > [email protected]><google-appengine%2Bunsubscrib
> > > > > [email protected]>
> > > > > > > .
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/google-appengine?hl=en.
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google App Engine" group.
> > > > > To post to this group, send email to
> [email protected]
> > > .
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib
> [email protected]><google-appengine%2Bunsubscrib
> > > [email protected]>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-appengine?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine" group.
> > > To post to this group, send email to [email protected]
> .
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib
> [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to