From: Oleg Broytman Date: Wed, 1 Jun 2016 15:11:53 +0000 (+0300) Subject: Change database pathname handling X-Git-Tag: 0.0.11~10 X-Git-Url: https://git.phdru.name/?p=m_librarian.git;a=commitdiff_plain;h=e40cd86d810518b13b511fee568a02539ed6b46c Change database pathname handling Recognize pathnames by absence of '://'. --- diff --git a/m_librarian/db.py b/m_librarian/db.py index 56b194d..8786a46 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -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)