smtplib upload progress

2009-10-19 Thread Guyon Morée
Hi,

I wanted to use smtplib to send a bunch of files. All good, except I
cant monitor the upload progress as far as I can see.

So I monkey patched the SMTP.sendall method, which chops up the data
and keeps calling a provided callback for every chunk of data sent.

This feels kind of dirty and I was wondering what my other options are
to tackle this seemingly simple problem.

thanx,

Guyon Moree
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib upload progress

2009-10-19 Thread Gabriel Genellina
En Mon, 19 Oct 2009 19:33:50 -0300, Guyon Morée guyon.mo...@gmail.com  
escribió:



I wanted to use smtplib to send a bunch of files. All good, except I
cant monitor the upload progress as far as I can see.

So I monkey patched the SMTP.sendall method, which chops up the data
and keeps calling a provided callback for every chunk of data sent.

This feels kind of dirty and I was wondering what my other options are
to tackle this seemingly simple problem.


(there is no sendall method in SMTP, but send)
Looks like there is no other way... perhaps I'd have overriden data()  
instead of send(), but it's as dirty as yours, one has to duplicate the  
original code.
I don't know how often the need arises or how useful would this be to  
others, but you could submit a patch to http://bugs.python.org/


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list