mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 09:03:07 +02:00
...
This commit is contained in:
parent
adabb0ee58
commit
03126d37f8
1 changed files with 8 additions and 2 deletions
|
|
@ -76,8 +76,14 @@ def connect(path, exc_class=ValueError):
|
|||
pdir = os.path.dirname(path)
|
||||
if os.path.isdir(pdir):
|
||||
raise exc_class('Failed to open userdb database at {} with error: {}'.format(path, as_unicode(e)))
|
||||
os.makedirs(pdir)
|
||||
return apsw.Connection(path)
|
||||
try:
|
||||
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)
|
||||
except apsw.CantOpenError as e:
|
||||
raise exc_class('Failed to open userdb database at {} with error: {}'.format(path, as_unicode(e)))
|
||||
|
||||
|
||||
class UserManager(object):
|
||||
|
|
|
|||
Loading…
Reference in a new issue