mirror of
https://git.zavage.net/Zavage-Software/app_skellington.git
synced 2024-12-21 22:29:20 -07:00
two small fixes: bugfix with older python and error ran into with a user program
This commit is contained in:
parent
076e609b80
commit
c74f09a3c4
@ -80,11 +80,25 @@ class CommandTree:
|
|||||||
Creates a root-level submenu with no entries. SubMenu node is
|
Creates a root-level submenu with no entries. SubMenu node is
|
||||||
returned which can have submenus and commands attached to it.
|
returned which can have submenus and commands attached to it.
|
||||||
"""
|
"""
|
||||||
|
# NOTE(MG) Fix below strategizes whether to pass in 'required'
|
||||||
|
# paremter to ArgumentParser.add_subparsers()
|
||||||
|
# which was added in in Python3.7.
|
||||||
|
func_args = {
|
||||||
|
'dest': param_name,
|
||||||
|
'metavar': param_name,
|
||||||
|
'required': is_required
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
sys.version_info.major == 3
|
||||||
|
and sys.version_info.minor <= 6
|
||||||
|
):
|
||||||
|
if is_required:
|
||||||
|
_bootstrap_logger.warn('Unable to enforce required submenu: Requires >= Python 3.7')
|
||||||
|
del func_args[required]
|
||||||
|
|
||||||
# Creates an argument as a slot in the underlying argparse.
|
# Creates an argument as a slot in the underlying argparse.
|
||||||
subparsers = self.root_parser.add_subparsers(
|
subparsers = self.root_parser.add_subparsers(
|
||||||
dest = param_name,
|
**func_args
|
||||||
metavar = param_name,
|
|
||||||
required = is_required
|
|
||||||
)
|
)
|
||||||
|
|
||||||
submenu = SubMenu(self, subparsers, param_name)
|
submenu = SubMenu(self, subparsers, param_name)
|
||||||
|
@ -108,8 +108,11 @@ class LoggingLayer:
|
|||||||
|
|
||||||
# Replace 'root' logger with '', logging module convention for root handler
|
# Replace 'root' logger with '', logging module convention for root handler
|
||||||
# Note: '' is disallowed in ConfigObj (hence the reason for this replacement)
|
# Note: '' is disallowed in ConfigObj (hence the reason for this replacement)
|
||||||
config_dict['loggers'][''] = config_dict['loggers']['root']
|
try:
|
||||||
del config_dict['loggers']['root']
|
config_dict['loggers'][''] = config_dict['loggers']['root']
|
||||||
|
del config_dict['loggers']['root']
|
||||||
|
except Exception as ex:
|
||||||
|
_bootstrap.logger.warn('internal failure patching root logger')
|
||||||
|
|
||||||
|
|
||||||
# Evaluate the full filepath of the file handler
|
# Evaluate the full filepath of the file handler
|
||||||
|
Loading…
Reference in New Issue
Block a user