[Sugar-devel] [PATCH v2 Browse] Remove temporary downloaded (cancelled) files SL #3973
Manuel Kaufmann
humitos at gmail.com
Tue Oct 2 14:52:41 EDT 2012
On Tue, Oct 2, 2012 at 1:43 PM, Martin Langhoff
<martin.langhoff at gmail.com> wrote:
>> + except:
>> + logging.warning('/proc/uptime could not be read')
>> + uptime = None
Should I use EnvironmentError[1] here too?
> Tiny optimization and elegance improvement: just calculate your cutoff
> here. The cutoff is the largest of
> - "yesterday" (now - 1 day)
> - boottime (now - uptime) -- if you managed to read uptime
What do you think about this?
cutoff = now - datetime.timedelta(days=1)
if uptime is not None:
boot_time = now - uptime
cutoff = max(yesterday, boot_time)
> Should catch both OSError _and_ IOError. Or perhaps EnvironmentError
> which, strange as the name might sound, is the granddaddy of both.
Yes, you are right
[1] http://docs.python.org/library/exceptions.html#exceptions.EnvironmentError
--
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
More information about the Sugar-devel
mailing list