]> git.phdru.name Git - m_librarian.git/commitdiff
Change database pathname handling
authorOleg Broytman <phd@phdru.name>
Wed, 1 Jun 2016 15:11:53 +0000 (18:11 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 1 Jun 2016 15:11:53 +0000 (18:11 +0300)
Recognize pathnames by absence of '://'.

m_librarian/db.py

index 56b194d0ac5621145d935d4343468249e7174adf..8786a461b8c69e4dd6fcfd032abce9054e5d7ddc 100755 (executable)
@@ -142,12 +142,7 @@ def open_db(db_uri=None):
         except:
             db_uri = find_sqlite_dburi()
 
-    if db_uri.startswith(os.sep) \
-            or os.altsep and db_uri.startswith(os.altsep) \
-            or db_uri.startswith(os.pardir + os.sep) \
-            or os.altsep and db_uri.startswith(os.pardir + os.altsep) \
-            or db_uri.startswith(os.curdir + os.sep) \
-            or os.altsep and db_uri.startswith(os.curdir + os.altsep):
+    if '://' not in db_uri:
         db_uri = 'sqlite://' + os.path.abspath(db_uri).replace(os.sep, '/')
 
     sqlhub.processConnection = connection = connectionForURI(db_uri)