[sugar] [PATCH] Trac #7480: Need to 'reset' the network configurations - short term fix

Michael Stone michael at laptop.org
Tue Aug 12 00:02:41 EDT 2008


On Mon, Aug 11, 2008 at 09:31:26PM -0400, Erik Garrison wrote:
>Attached is a patch which adds a 'reset network configuration' button to
>the network tab of the sugar control panel.

Thanks very much for the patch, and for the thoughtful design.

>+        n = 1 + max(map(lambda x: int(x.replace('networks.cfg.bak.', '')),
>+                        network_cfgs))

This expression, while cute, is unsafe and will result in failure if you
ever encounter a file with a name like 'networks.cfg.bak.hi'. Please
write total code or handle exceptions appropriately.

(Incidentally, does anything bad happen if your code does happen to
generate exceptions?)

Regards,

Michael


More information about the Sugar mailing list