]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/db.py
Rename -d/--details options to -v/--verbose
[m_librarian.git] / m_librarian / db.py
index 7e5744f243e64eabebe14afadd66f768a08e2430..f65569cb6e37183922b4dc6ae4e88a51e5bfec00 100755 (executable)
@@ -1,16 +1,16 @@
 #! /usr/bin/env python
 
-__all__ = ['Author', 'Book', 'Extension', 'Genre', 'Language',
-           'AuthorBook', 'BookGenre', 'open_db', 'init_db',
-           'insert_name', 'insert_author', 'update_counters',
-           ]
-
 import os
 from sqlobject import SQLObject, StringCol, UnicodeCol, IntCol, BoolCol, \
     ForeignKey, DateCol, DatabaseIndex, RelatedJoin, \
     connectionForURI, sqlhub, SQLObjectNotFound, dberrors
 from .config import get_config
 
+__all__ = ['Author', 'Book', 'Extension', 'Genre', 'Language',
+           'AuthorBook', 'BookGenre', 'open_db', 'init_db',
+           'insert_name', 'insert_author', 'update_counters',
+           ]
+
 
 class Author(SQLObject):
     surname = UnicodeCol(notNull=True)
@@ -146,7 +146,9 @@ def open_db(db_uri=None):
 
     if connection.dbName == 'sqlite':
         def lower(s):
-            return s.lower()
+            if isinstance(s, basestring):
+                return s.lower()
+            return s
 
         sqlite = connection.module