Ticket #5912: update-existing-calls.diff

File update-existing-calls.diff, 1.2 KB (added by tom.prince, 3 years ago)

This updates the existing examples to use this idiom.

  • doc/core/howto/process.xhtml

    === modified file 'doc/core/howto/process.xhtml'
     
    477477        if childFD == 1: self.plaintext += data
    478478        if childFD == 4: self.status += data
    479479    def processEnded(self, status):
    480         rc = status.value.exitCode
    481         if rc == 0:
    482             self.deferred.callback(self)
    483         else:
    484             self.deferred.errback(rc)
     480        if self.deferred is not None:
     481            d, self.deferred = self.deferred, None
     482            rc = status.value.exitCode
     483            if rc == 0:
     484                d.callback(self)
     485            else:
     486                d.errback(rc)
    485487
    486488def decrypt(crypttext):
    487489    gp = GPGProtocol(crypttext)
  • doc/web/howto/client.xhtml

    === modified file 'doc/web/howto/client.xhtml'
     
    347347        pass
    348348
    349349    def connectionLost(self, reason):
    350         self.deferred.callback(None)
     350        if self.deferred is not None:
     351            d, self.deferred = self.deferred, None
     352            d.callback(None)
    351353
    352354
    353355def cbRequest(response):