misc: small formatting and error checking improvements
This commit is contained in:
parent
369180ff85
commit
03f221a807
|
@ -1,8 +1,8 @@
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
event,
|
event,
|
||||||
select,
|
select,
|
||||||
)
|
)
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
@ -191,10 +191,10 @@ class WorblehatCli(NumberedCmd):
|
||||||
|
|
||||||
def do_exit(self, _: str):
|
def do_exit(self, _: str):
|
||||||
if self.sql_session_dirty:
|
if self.sql_session_dirty:
|
||||||
if prompt_yes_no('Would you like to save your changes?'):
|
if prompt_yes_no('Would you like to save your changes?'):
|
||||||
self.sql_session.commit()
|
self.sql_session.commit()
|
||||||
else:
|
else:
|
||||||
self.sql_session.rollback()
|
self.sql_session.rollback()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ class Config:
|
||||||
]
|
]
|
||||||
|
|
||||||
def __class_getitem__(cls, name: str) -> Any:
|
def __class_getitem__(cls, name: str) -> Any:
|
||||||
|
if cls._config is None:
|
||||||
|
raise RuntimeError('Configuration not loaded, call Config.load_configuration() first.')
|
||||||
|
|
||||||
__config = cls._config
|
__config = cls._config
|
||||||
for attr in name.split('.'):
|
for attr in name.split('.'):
|
||||||
__config = __config.get(attr)
|
__config = __config.get(attr)
|
||||||
|
|
Loading…
Reference in New Issue