[Twisted-Python] Re: Error Request did not return a string

DJ d.a.abernathy at gmail.com
Tue Aug 5 08:50:51 MDT 2008


Will request.finish have the same effect as return server.NOT_DONE_YET ?
Or do the statements do different things ?


On Mon, Aug 4, 2008 at 3:50 PM, Maarten ter Huurne
<maarten at treewalker.org>wrote:

> On Monday 04 August 2008, DJ wrote:
>
> > For some strange reason I this text is being added to the end of the html
> > pages rendered by twisted.
> > Request did not return a string
> >
> > Request:
> >
> > <GET /config/deleteSection HTTP/1.1>
> >
> >
> > Resource:
> >
> > <configPages.deleteSection instance at 0x00EC4EE0>
> >
> >
> > Value:
> >
> > None
> >
> > I am using the resource.Resource and render. My html is passed has a
> > string using request.write.
> > As far has I can tell, there should not be a problem. Does anyone know
> > why and what I need to do to fix this.
>
> Python functions implicitly return None if there is no return statement.
>
> Twisted.web wants the render method to either return a string, or the
> special object NOT_DONE_YET, which indicates that the reply will be written
> with request.write(). The name was probably chosen for cases where the
> content is written using deferreds, but it should be used even if you call
> request.write() from the render method.
>
> So try putting "return server.NOT_DONE_YET" at the end of your render
> method.
>
> Bye,
>                 Maarten
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>


-- 
Dafina A. Abernathy (DJ)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20080805/88f84b4b/attachment.html>


More information about the Twisted-Python mailing list