https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
Bug ID: 73489 Summary: redirect.py fails with -moves option Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: major Priority: Unprioritized Component: redirect.py Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: info@gno.de Web browser: --- Mobile Platform: ---
redirect.py fails with -moves option:
C:\pwb\core>pwb.py redirect.py do -always -moves Retrieving all moved pages via API... ............................
Rosetta-Lander <<<
Links to: [[Philae (Sonde)]]. Links to: [[Philae]]. Traceback (most recent call last): File "C:\pwb\core\pwb.py", line 181, in <module> run_python_file(fn, argv, argvu) File "C:\pwb\core\pwb.py", line 75, in run_python_file exec(compile(source, filename, "exec"), main_mod.__dict__) File "C:\pwb\core\scripts\redirect.py", line 821, in <module> main() File "C:\pwb\core\scripts\redirect.py", line 818, in main bot.run() File "C:\pwb\core\scripts\redirect.py", line 721, in run self.fix_double_redirects() File "C:\pwb\core\scripts\redirect.py", line 528, in fix_double_redirects self.fix_1_double_redirect(redir_name) File "C:\pwb\core\scripts\redirect.py", line 665, in fix_1_double_redirect '#%s %s' % (self.site.redirect(True), File "C:\pwb\core\pywikibot\tools.py", line 647, in wrapper return obj(*__args, **__kw) TypeError: redirect() takes exactly 1 argument (2 given) <type 'exceptions.TypeError'> CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
C:\pwb\core>
corresponding version is:
C:\pwb\core>pwb.py version Pywikibot: pywikibot-core (f12709d, s5607, 2014/11/16, 00:47:43, ok) Release version: 2.0b2 httplib2 version: 0.9 cacerts: C:\pwb\core\externals\httplib2\python2\httplib2\cacerts.txt certificate test: ok Python: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] unicode test: ok
Older code does still the job well:
c:\Pywikipedia\ssh\pywikibot\core>pwb.py version.py Pywikibot: [ssh] pywikibot-core (dfdc0c9, g4462, 2014/11/03, 07:43:21, OUTDATED)
Release version: 2.0b2 httplib2 version: 0.9 cacerts: C:\Pywikipedia\ssh\pywikibot\core\externals\httplib2\python2\httplib2 \cacerts.txt certificate test: ok Python: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] unicode test: ok
c:\Pywikipedia\ssh\pywikibot\core>
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #1 from xqt info@gno.de --- Seems the decorator does not handle arguments for redirect as expected:
import pwb import pywikibot as py s = py.Site() x = s.redirect() x
u'WEITERLEITUNG'
x = s.redirect(True)
Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> x = s.redirect(True) File "pywikibot\tools.py", line 647, in wrapper return obj(*__args, **__kw) TypeError: redirect() takes exactly 1 argument (2 given)
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #2 from xqt info@gno.de --- The corresponding patch was https://gerrit.wikimedia.org/r/#/c/172499/
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
Fabian CommodoreFabianus@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |CommodoreFabianus@gmx.de
--- Comment #3 from Fabian CommodoreFabianus@gmx.de --- The decorator only handles keyword arguments. I had a patch for positional arguments although that made it considerably more complex: https://gerrit.wikimedia.org/r/155020/
So the script could be fixed, but unfortunately other scripts won't be compatible if they use the argument positionally.
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #4 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 173659 had a related patch set uploaded by XZise: [FIX] Don't use deprecated parameter of redirect()
https://gerrit.wikimedia.org/r/173659
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #5 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 173659 merged by jenkins-bot: [FIX] Don't use deprecated parameter of redirect()
https://gerrit.wikimedia.org/r/173659
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
Fabian CommodoreFabianus@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |NEW
--- Comment #6 from Fabian CommodoreFabianus@gmx.de --- This patch should fix your problem but still: Do we want to ignore that compat scripts might break because of this?
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jayvdb@gmail.com
--- Comment #7 from John Mark Vandenberg jayvdb@gmail.com --- @Fabian, IMO this provides a good use case to make use of your code for deprecating positional arguments. As positional arguments are a lot more error prone to play with, we may want to build a few specific tools (that cant-be/shouldnt-be used with other deprecators) rather than one magical tool which is very complex and error prone if mixed with other deprecators/decorators.
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #8 from xqt info@gno.de --- I guess we should not ignore it without any hint. What about the other methods where the arguments are obsolete with the previous patch?
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #9 from Fabian CommodoreFabianus@gmx.de --- What about them? In our code base are no callers of those methods or they don't use the deprecated parameter (at least git grep ".…(" told me). But obviously for a later patch which avoids breakage those should be included as well.
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |70936
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|redirect.py fails with |Page.redirect deprecated |-moves option |argument usage can cause | |exception
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Page.redirect deprecated |Site.redirect deprecated |argument usage can cause |argument usage can cause |exception |exception
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
--- Comment #10 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 174107 had a related patch set uploaded by XZise: [FIX] Allow deprecation of all parameters
https://gerrit.wikimedia.org/r/174107
https://bugzilla.wikimedia.org/show_bug.cgi?id=73489
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
pywikipedia-bugs@lists.wikimedia.org