[Twisted-Python] twisted.web response.py questions

peter commercials24 at yahoo.de
Fri Dec 4 05:42:55 MST 2015


hi,


looking over:
https://twistedmatrix.com/documents/14.0.2/_downloads/response.py


im not really sure why one would use the line:

self.remaining  =  1024  *  10


this suggest to me that one knew what kind of page size was 
expected...but what if you dont?
wouldnt it make more sense to use someting like this:

def dataReceived(self, bytes):
         self.page_content = self.page_content + bytes


this would sum up all the data until connectionLost is called.
and in connectionLost():

def  connectionLost(self,  reason):
         print  'Finished receiving body:',  reason.getErrorMessage()
         self.finished.callback(self.page_content)


and then print it?




also i dont get why one would use

  return  finished


in cbRequest. where is this finished returned to?
its called via:

d.addCallback(cbRequest)

isnt the result from cbRequest thrown away?
i would expect the line to read:
new_deferred = d.addCallback(cbRequest)



thx for your answers






_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



More information about the Twisted-Python mailing list