Fixup commit

This commit is contained in:
Lucas Verney 2021-03-14 18:00:36 +01:00
parent e32db2648a
commit 3201c3ddd3
4 changed files with 24 additions and 8 deletions

View File

@ -99,7 +99,7 @@ def parse_args(argv=None):
# Test subcommand parser
subparsers.add_parser("test", parents=[parent_parser], help="Unit testing.")
return parser.parse_args(argv)
return parser, parser.parse_args(argv)
def main():
@ -108,14 +108,14 @@ def main():
"""
# pylint: disable=locally-disabled,too-many-branches
# Parse arguments
args = parse_args()
parser, args = parse_args()
# Set logger
if args.vv:
if getattr(args, 'vv', False):
logging.getLogger("").setLevel(logging.DEBUG)
logging.getLogger("titlecase").setLevel(logging.INFO)
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
elif args.verbose:
elif getattr(args, 'verbose', False):
logging.getLogger("").setLevel(logging.INFO)
# sqlalchemy INFO level is way too loud, just stick with WARNING
logging.getLogger("sqlalchemy.engine").setLevel(logging.WARNING)
@ -128,6 +128,10 @@ def main():
flatisfy.config.init_config(args.output)
sys.exit(0)
else:
if not args.cmd:
parser.print_help()
sys.exit(0)
# Load config
if args.cmd == "build-data":
# Data not yet built, do not use it in config checks

View File

@ -78,7 +78,14 @@ class WebOOBProxy(object):
self.webnip = WebNip(modules_path=config["modules_path"])
# Create backends
self.backends = [self.webnip.load_backend(module, module, params={}) for module in backends]
self.backends = []
for module in backends:
try:
self.backends.append(
self.webnip.load_backend(module, module, params={})
)
except Exception as exc:
raise Exception('Unable to load module ' + module) from exc
def __enter__(self):
return self

View File

@ -149,14 +149,18 @@ class Flat(BASE):
"""
Date validation method
"""
return arrow.get(date).naive
if date:
return arrow.get(date).naive
return None
@validates("visit_date")
def validate_visit_date(self, _, visit_date):
"""
Visit date validation method
"""
return arrow.get(visit_date).naive
if visit_date:
return arrow.get(visit_date).naive
return None
@validates("photos")
def validate_photos(self, _, photos):

View File

@ -16,5 +16,6 @@ titlecase
unidecode
vobject
whoosh
https://git.weboob.org/weboob/weboob/repository/archive.zip?ref=master
git+https://git.weboob.org/weboob/weboob/
git+https://git.weboob.org/weboob/modules/
money