jschuengel: thuban/Extensions/umn_mapserver mf_handle.py,1.1,1.2

Bernhard Herzog bh at intevation.de
Tue Jul 6 18:03:52 CEST 2004


cvs at intevation.de writes:

> Index: mf_handle.py
> ===================================================================
> RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_handle.py,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -d -r1.1 -r1.2
> --- mf_handle.py	1 Jul 2004 14:35:07 -0000	1.1
> +++ mf_handle.py	6 Jul 2004 14:30:45 -0000	1.2
[...]
> @@ -443,6 +445,9 @@
>          self.umn_legend.set_keyspacing(self.text_keyspacing_width.GetValue(),self.text_keyspacing_height.GetValue())

Please keep lines shorter than 80 characters.

> +        try:
> +            insidetxt = self.umn_scalebar.get_size()
> +        except:
> +            insidetxt = (0,0)

Bare excepts, that is excepts without an explicit exception class, are
almost always a bad idea.  They often hide errors that will be hard to
track down later, especially if -- as in this case -- they're silent,
i.e. do not print any information to stdout/stderr or pop up an error
dialog.

In this particular case I don't see why you would even want to catch an
exception.  How can self.umn_scalebar.get_size() fail?

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)