Submitted by : simon at: 2007-05-15T11:01:29-07:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Moved from #1335:

Can we get rid of hasattr() in updateWikiOutline? --betabug, Thu, 10 May 2007 02:58:56 -0700 reply

hasattr() can mask all kind of errors, so I feel we should get rid of it in updateWikiOutline and use something similar to what's described here:

Bare excepts --wlang, Thu, 10 May 2007 04:34:43 -0700 reply

Getting rid of hasattr is a good thing, but i dont think it can mask unicodedecoderrors. But there are also bare excepts, and they can swallow unicode errors. Eg, in "upgradeAll" is a bare except around "fixEncoding". I presume this has caused the empty page i observed. Can we also get rid of those bare excepts?

Bare excepts --betabug, Thu, 10 May 2007 05:35:57 -0700 reply

Yes! Those bare excepts are on my "hunt down to kill" list. I've already made a lot of progress with them, see #1317 - but sometimes it's hard to spot from the code what exceptions actually should be catched. That's why they are not yet all gone.

hasattr switched to safe_hasattr --betabug, Thu, 10 May 2007 05:42:01 -0700 reply

I've done that change everywhere, except in some dtml and zpt's. Will probably use getattr() there directly, have to look at them in detail. That bare except in upgradeAll really is of concern to us. It's scary, but should be fixed up for sure.

... --simon, Tue, 15 May 2007 11:02:09 -0700 reply

Name: '#1352 hasattr can mask problems, replace' => '#1352 hasattr can mask problems, replace it'

On Betabug's List

last replacements sent in to darcs now, closing --betabug, Sun, 18 Nov 2007 07:10:45 -0800 reply

Status: open => closed

But of course we should be careful not to let any new one's slip into the code.