mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
use urllib.parse.urlparse to check for xml on python Session init
This commit is contained in:
parent
b9c6fc2876
commit
3e842a7bf6
@ -29,6 +29,8 @@
|
||||
# @ingroup python_bindings
|
||||
|
||||
from enum import IntEnum
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from gnucash import gnucash_core_c
|
||||
from gnucash import _sw_core_utils
|
||||
|
||||
@ -228,7 +230,8 @@ class Session(GnuCashCoreClass):
|
||||
# Any existing store obviously has to be loaded
|
||||
# More background: https://bugs.gnucash.org/show_bug.cgi?id=726891
|
||||
is_new = mode in (SessionOpenMode.SESSION_NEW_STORE, SessionOpenMode.SESSION_NEW_OVERWRITE)
|
||||
if book_uri[:3] != "xml" or not is_new:
|
||||
scheme = urlparse(book_uri).scheme
|
||||
if not (is_new and scheme == 'xml'):
|
||||
self.load()
|
||||
except GnuCashBackendException as backend_exception:
|
||||
self.end()
|
||||
|
Loading…
Reference in New Issue
Block a user