[Pywikipedia-l] Two minor problems in replace.py (attn xqt)

Bináris wikiposta at gmail.com
Fri Feb 25 14:16:33 UTC 2011


Hi!

In replace.py, current version 8920, line 444:
if not page.canBeEdited():
should change to
if not self.articles and not page.canBeEdited():
The reason is that with the new -save/-savenew options (introduced in rev
8700) we may use replace.py for gathering titles, and that's what I am doing
in the minute. I want to collect titles from* fr, es, de* Wikipedias rather
than my home wiki, but they seem not to allow edits without botflag. I don't
need a flag and I won't change anything there, only save titles from those
wikis, but the current line 444 prevents me of doing that. self.articles is
not None iff -save or -savenew option is used, which means we don't edit the
wiki.

Another issue is with line 843,
            titlefile = codecs.open(filename, encoding='utf-8',
                                    mode=(lambda x: x and 'a' or
'w')(append))
I tested my original version which had an IF here as far as I remember, and
you turned it to lambda function. But somehow the -save option behaves now
just as -savenew does, i.e. overwrites the old file instead of appending.
Could you please help?

-- 
Bináris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/pywikipedia-l/attachments/20110225/bfb8d32c/attachment.htm 


More information about the Pywikipedia-l mailing list