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

View File

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

View File

@ -16,5 +16,6 @@ titlecase
unidecode unidecode
vobject vobject
whoosh 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 money