mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
adabb0ee58
commit
03126d37f8
@ -76,8 +76,14 @@ def connect(path, exc_class=ValueError):
|
|||||||
pdir = os.path.dirname(path)
|
pdir = os.path.dirname(path)
|
||||||
if os.path.isdir(pdir):
|
if os.path.isdir(pdir):
|
||||||
raise exc_class('Failed to open userdb database at {} with error: {}'.format(path, as_unicode(e)))
|
raise exc_class('Failed to open userdb database at {} with error: {}'.format(path, as_unicode(e)))
|
||||||
|
try:
|
||||||
os.makedirs(pdir)
|
os.makedirs(pdir)
|
||||||
|
except EnvironmentError as e:
|
||||||
|
raise exc_class('Failed to make directory for userdb database at {} with error: {}'.format(pdir, as_unicode(e)))
|
||||||
|
try:
|
||||||
return apsw.Connection(path)
|
return apsw.Connection(path)
|
||||||
|
except apsw.CantOpenError as e:
|
||||||
|
raise exc_class('Failed to open userdb database at {} with error: {}'.format(path, as_unicode(e)))
|
||||||
|
|
||||||
|
|
||||||
class UserManager(object):
|
class UserManager(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user