From: Oleg Broytman Date: Sat, 1 Nov 2003 14:39:24 +0000 (+0000) Subject: Do not barf at int(None). X-Git-Tag: v4.5.3~354 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=43c6fe1b6c14b7494e1c73ef57b61ae8c11f956a;p=bookmarks_db.git Do not barf at int(None). git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@22 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/sort_db.py b/sort_db.py index 60e3d41..3e4399c 100755 --- a/sort_db.py +++ b/sort_db.py @@ -23,12 +23,12 @@ class SortBy: def __call__(self, o1, o2): try: attr1 = int(getattr(o1, self.sort_by)) - except (TypeError, AttributeError): + except (AttributeError, TypeError, ValueError): return 1 try: attr2 = int(getattr(o2, self.sort_by)) - except (TypeError, AttributeError): + except (AttributeError, TypeError, ValueError): return -1 return cmp(attr1, attr2)