Hi,
I run my bot in some projects where I do handle broken/double redirects repairs. IIRC in the past the redirect.py script did tagged for deletion the broken redirects if the bot didn't had sysop rights (or a sysop was not in the 'sysopnames' var in user_config).
Why was this functionality removed? Did it gave problems? - I would be interested in having it back. I even remember having translated some messages in translatewiki.net for that.
Thank you,
-M.
For all Amsterdam hackathon attendees
We've made a first draft of the programme for the Amsterdam Hackathon. We
have room for 6 workshops which will be run twice over the course of the
Hackathon.
Which topics should we cover in them? Based on your motivations, we've made
a list of the top 8 topics that seem to be of interest. Please take a look
at the page and let us know which topics you'd be most interested in:
https://www.mediawiki.org/wiki/Amsterdam_Hackathon_2013/Topics
For some of these workshops we're still looking for presenters. Are you
interested? Let us know! (hackathon(a)wikimedia.nl)
Think you could fill a 1h (interactive) workshop for one of these topics,
but you're not sure? I'll help you create a workshop and help you practice
beforehand.
Finne (henna)
On behalf of the programme committee
Hi all,
Would it ever make sense to change the whole -argumentname: command
line argument style? For instance, replace it with the standard
argument handling provided by Python[0] or (GNU) getopt[1]. As every
style change, this may just be me, but I can still list a couple of
reasons to do this:
- Standard command line arguments
- Offload the argument parsing code to tried and true libraries
Maybe in the rewrite branch?
David E. Narvaez
[0] http://docs.python.org/2/library/argparse.html
[1] http://docs.python.org/2/library/getopt.html
Hi,
Each ns:0 page on English Wiktionary is divided into a bunch of
sections headed by level-2 headers. The text of each level-2 header
is the name of a language; e.g., ==English==.
I use (something like) the following JavaScript when editing pages:
txt =
txt.replace
( /^==([a-zA-Z ]+)==\n+(?:(?:===|[^=]).*\n+)*/gm,
function(section, langname)
{ return '' +
section.replace
( /(\{\{homophones\|)([^=}]*\}\})/gm,
'$1lang={'+'{subst:langrev|'+langname+'}}|$2'
);
}
);
This searches for {{homophones|...}} without a lang= parameter and
adds the lang= parameter appropriate for the ==section== in which
{{homophones|...}} appears. This works.
I want to automate this, so wish to use pywikipediabot. So I've
translated the above into Python as best I could, and come up with the
following user-fixes.py :
def homophix(match):
return re.sub(r'(\{\{homophones\|)([^}=]*\}\})',
r'\1lang={{subst:langrev|'+re.escape(match.group(1))+r'}}|\2',
match.group(0)
)
fixes['homophones'] = {
'regex': True,
'msg': {'_default':u'add lang to homophones'},
'replacements': [
(ur'^==([a-zA-Z ]+)==\n+(?:(?:===|[^=]).*\n+)*', homophix)
]
}
...which I then tried to call using
python replace.py -fix:homophones -page:accapare
(Note that [[wikt:en:accapare]] has {{homophones|...}} without = .)
Python told me:
No changes were necessary in [[accapare]]
0 pages were changed.
So I guess it's either not matching or not replacing.
What am I doing wrong?
And what can I do instead?
Thanks,
Michael Hamm
Bináris <wikiposta(a)gmail.com>:
> Try this first in replacements:
>
> ur'(?m)^== *([a-zA-Z ]+) *==\n+ etc.
> m for multiline (sometimes ?s works instead, I just use it without
> understanding why), and space* in case there are spaces between == marks.
Sorawee Porncharoenwase <nullzero.free(a)gmail.com>:
> @Michael Hamm: Beside Bináris's suggestion, re.escape should be used only
> on pattern parameter, not replacing text; use match.group(1) instead of
> re.escape(match.group(1))
Thank you both very much. Probably (I won't be able to test it until
later today) these were the problem -- or part of it.
Michael Hamm