Xqt has submitted this change and it was merged.

Change subject: Fix auto-summary in delete.py
......................................................................


Fix auto-summary in delete.py

mysite was not defined. pywikibot.handleArgs is guaranteed to return
a list (as opposed to a generator) after parsing all global arguments
(such as -lang and -family). This means it's safe to call
pywikibot.getSite immediately after handleArgs, but before handling
local arguments.

Change-Id: I0bd76806e460fec200973a712370e459c9189ea7
Fixes-Change-Id: I386328c62b1bbeb7022a620f8e95d25a67686371
---
M delete.py
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/delete.py b/delete.py
index d1e2c13..b51a594 100644
--- a/delete.py
+++ b/delete.py
@@ -75,7 +75,10 @@
     generator = None
 
     # read command line parameters
-    for arg in pywikibot.handleArgs():
+    localargs = pywikibot.handleArgs()
+    mysite = pywikibot.getSite()
+
+    for arg in localargs:
         if arg == '-always':
             always = True
         elif arg.startswith('-summary'):
@@ -105,7 +108,7 @@
                 summary = i18n.twtranslate(mysite, 'delete-referring-pages', 
{'page': pageName})
             elif arg.startswith('-file'):
                 summary = i18n.twtranslate(mysite, 'delete-from-file')
-    mysite = pywikibot.getSite()
+
     if doImages:
         if not summary:
             summary = i18n.twtranslate(mysite, 'delete-images',
@@ -131,4 +134,4 @@
     try:
         main()
     finally:
-        pywikibot.stopme()
\ No newline at end of file
+        pywikibot.stopme()

-- 
To view, visit https://gerrit.wikimedia.org/r/83808
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0bd76806e460fec200973a712370e459c9189ea7
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to