]> git.phdru.name Git - bookmarks_db.git/blobdiff - sort_db.py
Split parse_html/__init__.py into __main__.py
[bookmarks_db.git] / sort_db.py
index 60e3d4179437ac47d0de23c81de13c65af1a3ea0..f3a5ff1ce203bfed6fe159175777aba21c6556d2 100755 (executable)
@@ -1,6 +1,5 @@
-#! /usr/local/bin/python -O
-"""
-   Sort bookmarks DB according to a rule:
+#! /usr/bin/env python
+"""Sort bookmarks DB according to a rule:
       -a - by AddDate
       -v - by LastVisit
       -m - by LastModified
@@ -9,9 +8,12 @@
    default is -m
       -r - reverse the sort order
 
-   Written by BroytMann, Apr 2000. Copyright (C) 2000 PhiloSoft Design
+This file is a part of Bookmarks database and Internet robot.
 """
 
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
+__license__ = "GNU GPL"
 
 import sys
 
@@ -23,12 +25,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)