]> git.phdru.name Git - bookmarks_db.git/blobdiff - sort_db.py
Stopped tracking the text of the GPL license. Moved it to doc subdirectory.
[bookmarks_db.git] / sort_db.py
index 60e3d4179437ac47d0de23c81de13c65af1a3ea0..ed22fda52914cc8de997ce2a1a64699dc6932960 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/local/bin/python -O
+#! /usr/bin/env python
 """
    Sort bookmarks DB according to a rule:
       -a - by AddDate
@@ -9,7 +9,7 @@
    default is -m
       -r - reverse the sort order
 
-   Written by BroytMann, Apr 2000. Copyright (C) 2000 PhiloSoft Design
+   Written by Broytman, Apr 2000. Copyright (C) 2000 PhiloSoft Design
 """
 
 
@@ -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)