diff --git a/pokedex/db/load.py b/pokedex/db/load.py index 023f7a8..522d691 100644 --- a/pokedex/db/load.py +++ b/pokedex/db/load.py @@ -431,11 +431,11 @@ def dump(session, tables=[], directory=None, verbose=False, langs=None): # if specified, or for official languages by default. # For non-translation tables, dump all rows. if 'local_language_id' in columns: - # If no lang arguments were passed or the 'all' argument was passed - if langs is None or langs == ['all']: + if langs is None: def include_row(row): return languages[row.local_language_id].official - # If the none argument is passed then nothing should be changed from the csv files + # If the none code is passed, then all the csv files with the local_language_id + # column are not updated. In other words they are left blank. elif langs == ['none']: return False elif any(col.info.get('official') for col in table.columns): diff --git a/pokedex/main.py b/pokedex/main.py index 51d16a1..af229b0 100644 --- a/pokedex/main.py +++ b/pokedex/main.py @@ -114,7 +114,7 @@ def create_parser(): help="directory to place the dumped CSV files") cmd_dump.add_argument( '-l', '--langs', dest='langs', default=None, - help=u"comma-separated list of language codes to load, 'none', 'all', or other languages like 'en,es' (default: all). The 'all' and 'none' codes cannot be used with other codes.") + help=u"comma-separated list of language codes to load, 'none', or 'all' (default: all)") cmd_dump.add_argument( 'tables', nargs='*', help="list of database tables to load (default: all)") @@ -210,9 +210,13 @@ def command_dump(parser, args): if args.langs is not None: langs = [l.strip() for l in args.langs.split(',')] + # If the langs code is only 'all' then langs is None so that all the tables get dumped. + if len(langs) == 1 and langs[0] == 'all': + langs = None + # Check if either 'all' or 'none' codes are used along side other codes. - # If either code is used, an error message will be displayed and the progrm will close. - if len(langs) > 1 and 'all' in langs: + # If either code is used, an error message will be displayed and the program will close. + elif len(langs) > 1 and 'all' in langs: print("\nERROR: The 'all' code should be used by itself.") return elif len(langs) > 1 and 'none' in langs: