Skip to content

Commit

Permalink
Merge "[fix] check for valid family and site option after -help is pr…
Browse files Browse the repository at this point in the history
…ocessed"
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Nov 11, 2023
2 parents 61edf3c + 0833332 commit eec06f0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pywikibot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,15 +991,6 @@ def handle_args(args: Optional[Iterable[str]] = None,
# argument not global -> specific bot script will take care
non_global_args.append(arg)

if calledModuleName() != 'generate_user_files': # T261771
try:
pywikibot.Site()
except (UnknownFamilyError, UnknownSiteError):
pywikibot.exception(exc_info=False)
sys.exit(1)
if calledModuleName() == 'wrapper':
pywikibot._sites.clear()

if username:
config.usernames[config.family][config.mylang] = username

Expand All @@ -1014,6 +1005,15 @@ def handle_args(args: Optional[Iterable[str]] = None,
show_help(show_global=do_help_val == 'global')
sys.exit(0)

if calledModuleName() != 'generate_user_files': # T261771
try:
pywikibot.Site()
except (UnknownFamilyError, UnknownSiteError):
pywikibot.exception(exc_info=False)
sys.exit(1)
if calledModuleName() == 'wrapper':
pywikibot._sites.clear()

debug('handle_args() completed.')
return non_global_args

Expand Down

0 comments on commit eec06f0

Please sign in to comment.