[Twisted-Python] Large Transfers

Andrew Bennetts andrew-twisted at puzzling.org
Sat May 10 11:36:28 EDT 2003


On Sat, May 10, 2003 at 08:20:37AM -0700, Uwe C. Schroeder wrote:
> You're right, it doesn't. However it still requires several calls to transfer 
> the whole set. :-( And it has another problem. The pager makes it hard to 
> give the user some response while uploading/downloading. The UI gets stuck, 
> or at least appears to be since nothing is happening.

(Untested code)

class ProgressReportingStringPager(StringPager):
    def __init__(self, ui, *args, **kwargs):
        self.ui = ui
        StringPager.__init__(self, *args, **kwargs)
        
    def nextPage(self):
        StringPager.nextPage(self)
        self.ui.reportProgress(self.pointer/len(self.string))

I haven't tried, but it looks like something like that code could easily
give you progress reporting from your pager.  The paging code is really
quite simple.

-Andrew.





More information about the Twisted-Python mailing list