[Twisted-Python] Resource.render() returning NOT_DONE_YET

Clark C. Evans cce at clarkevans.com
Mon Apr 28 12:09:35 EDT 2003

I was just giving a quick Twisted tutorial to someone using
twisted and as we were breaking page construction into more
than one chunk... an unexpected stumbling block occurred --
returning NOT_DONE_YET form the resource's render() function.

I was thinking about two other options:

  1.  Perhaps NOT_DONE_YET could just be None, this 
      way, it can be the default return value.  As I'm
      browsing through my code this is the most common
      return... why not make it the default.

  2.  Alternatively, allow a Deferred to be a return 
      value.  Then the underlying caller can add 
      result.finish() to the deferred chain.   This
      has the advantage of not requiring finish() to
      really be managed.   Either the return value is
      a string, a Deferred, (or for backwards compatibiliy
      NOT_DONE_YET).  In either of the primary cases,
      result.finish() always gets called... thus making
      it easier on newbies.

Ideally, both of the above options could be used...



More information about the Twisted-Python mailing list