https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
Web browser: --- Bug ID: 54567 Summary: Minor improvements on add_text.py Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/patches/537/ Reported by: phoenixca Created on: 2012-01-21 20:06:11 Subject: Minor improvements on add_text.py Original description: Added an open in browser option to confirmation dialogue (similar to replace.py ) and added a new -only arg (essentially the opposite of -except). If a page text doesn't match the -only regex given, it skips.
Example use: I added this while trying to clean-up a Wikia wiki. Wikia's RTE leaves [[File:Placeholder on pages often. With this addition, the bot can use -only:"[[File:Placeholder" -except:"{{image}}" -text:"{{image}}" -up , to add a meta tag to pages that have image placeholders, but not ones that already have the {{image}} tag.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- diff file for add_text.py -only and open in browser additions
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #2 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- diff file for add_text.py -only and open in browser additions (take two! :) )
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #3 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- I know this is not a real pagegenerator, but why don't make regexOnly a global parameter, which can be used for every other script? It may be useful for many other scripts (like replace.py, but also templatecount.py or category.py sometimes).
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #4 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Looks very nice. There are a few (minor) issues that should be fixed though: * the regexOnly should be added at *last* parameter in add_text, so as not to break API compatibility * Match was %s""" % result) doesn't make sense if there is no match (result will always be [])
and I cnanot see this (I'm only looking at the diff, lazy me) - what is the goal of the 'continue' on line 61 of the diff? If I look at the return just above, there is no for loop going on, which makes the continue do nothing... but I may be wrong.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #5 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Ah, all good points. I'll fix those up and upload a new diff here. (Forgive the newbie to programming. I'm learning out of necessity for wiki administration.)
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
--- Comment #6 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- @nickanc: yes, this would be a good idea. There are several parameters in replace.py that really should be moved to pagegenerators as a 'filter' generator (-requiretitle with/without regex, excepttext with/without regex,). However, given this, I don't think there is a huge harm in adding another one. Xqt, what do you think?
I have applied the webbrowser part in r10034 [ http://toolserver.org/~pywikipedia/r10034 ], as I think that part is good in any case (and the patch should be applied in seperate commits anyway)
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/patches/537
https://bugzilla.wikimedia.org/show_bug.cgi?id=54567
Amir Ladsgroup ladsgroup@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |High CC| |ladsgroup@gmail.com Assignee|Pywikipedia-bugs@lists.wiki |ladsgroup@gmail.com |media.org | Summary|Minor improvements on |Add "-only" option to |add_text.py |add_text.py Severity|normal |enhancement
--- Comment #7 from Amir Ladsgroup ladsgroup@gmail.com --- Really interesting patch
pywikipedia-bugs@lists.wikimedia.org