Martineznovo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155720

Change subject: Adding a bunch of actions to block on simulate mode
......................................................................

Adding a bunch of actions to block on simulate mode

There were several actions that weren't listed in actions_to_block,
but also perform modifications on the server. Adding them so they
respect the -simulate option

I went to https://www.mediawiki.org/w/api.php and added all of them
that are part of core and the description contains "This module
requires read rights"

Bug: 69896
Change-Id: Ibbd05e86bf585e3c9f21670fd2be1978dbe27ebd
---
M pywikibot/config2.py
M pywikibot/site.py
2 files changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/20/155720/1

diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 4b31fc1..f244fd8 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -642,7 +642,10 @@
 # servers. Allows simulation runs of bots to be carried out without changing 
any
 # page on the server side. This setting may be overridden in user_config.py.
 actions_to_block = ['edit', 'watch', 'move', 'delete', 'undelete', 'protect',
-                    'emailuser']
+                    'emailuser', 'createaccount', 'setnotificationtimestamp',
+                    'rollback', 'block', 'unblock', 'upload', 'filerevert',
+                    'patrol', 'import', 'userrights', 'options', 'purge',
+                    'revisiondelete']
 
 # Set simulate to True or use -simulate option to block all actions given 
above.
 simulate = False
diff --git a/pywikibot/site.py b/pywikibot/site.py
index befcf3a..698be2d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3950,7 +3950,10 @@
             pywikibot.output(u"Upload: unrecognized response: %s" % result)
         if result["result"] == "Success":
             pywikibot.output(u"Upload successful.")
-            filepage._imageinfo = result["imageinfo"]
+            # If we receive a nochange, that would mean we're in simulation
+            # mode, don't attempt to access imageinfo
+            if "nochange" not in result:
+                filepage._imageinfo = result["imageinfo"]
             return
 
     @deprecate_arg("number", "step")

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbd05e86bf585e3c9f21670fd2be1978dbe27ebd
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Martineznovo <[email protected]>

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

Reply via email to