From 026d9992f0afb305b3c5efab397165d2d1b3cd23 Mon Sep 17 00:00:00 2001 From: richard Date: Sat, 15 Dec 2001 23:47:47 +0000 Subject: [PATCH] Cleaned up some bare except statements git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@469 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/hyperdb.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index 5310db7..b44e399 100644 --- a/roundup/hyperdb.py +++ b/roundup/hyperdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: hyperdb.py,v 1.40 2001-12-14 23:42:57 richard Exp $ +# $Id: hyperdb.py,v 1.41 2001-12-15 23:47:47 richard Exp $ __doc__ = """ Hyperdatabase implementation, especially field types. @@ -159,7 +159,7 @@ class Class: if not num_re.match(value): try: value = self.db.classes[link_class].lookup(value) - except: + except (TypeError, KeyError): raise IndexError, 'new property "%s": %s not a %s'%( key, value, link_class) elif not self.db.hasnode(link_class, value): @@ -184,7 +184,7 @@ class Class: if not num_re.match(entry): try: entry = self.db.classes[link_class].lookup(entry) - except: + except (TypeError, KeyError): raise IndexError, 'new property "%s": %s not a %s'%( key, entry, self.properties[key].classname) l.append(entry) @@ -330,7 +330,7 @@ class Class: if not num_re.match(value): try: value = self.db.classes[link_class].lookup(value) - except: + except (TypeError, KeyError): raise IndexError, 'new property "%s": %s not a %s'%( key, value, self.properties[key].classname) @@ -359,7 +359,7 @@ class Class: if not num_re.match(entry): try: entry = self.db.classes[link_class].lookup(entry) - except: + except (TypeError, KeyError): raise IndexError, 'new property "%s": %s not a %s'%( key, entry, self.properties[key].classname) l.append(entry) @@ -599,7 +599,7 @@ class Class: elif not num_re.match(entry): try: entry = link_class.lookup(entry) - except: + except (TypeError,KeyError): raise ValueError, 'property "%s": %s not a %s'%( k, entry, self.properties[k].classname) u.append(entry) @@ -615,7 +615,7 @@ class Class: if not num_re.match(entry): try: entry = link_class.lookup(entry) - except: + except (TypeError,KeyError): raise ValueError, 'new property "%s": %s not a %s'%( k, entry, self.properties[k].classname) u.append(entry) @@ -723,11 +723,8 @@ class Class: if (isinstance(propclass, String) or isinstance(propclass, Date)): # it might be a string that's really an integer - try: - av = int(av) - bv = int(bv) - except: - pass + av = int(av) + bv = int(bv) if dir == '+': r = cmp(av, bv) if r != 0: return r @@ -871,6 +868,11 @@ def Choice(name, *options): # # $Log: not supported by cvs2svn $ +# Revision 1.40 2001/12/14 23:42:57 richard +# yuck, a gdbm instance tests false :( +# I've left the debugging code in - it should be removed one day if we're ever +# _really_ anal about performace :) +# # Revision 1.39 2001/12/02 05:06:16 richard # . We now use weakrefs in the Classes to keep the database reference, so # the close() method on the database is no longer needed. -- 2.30.2