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

info at gno.de info at gno.de
Fri Feb 25 14:49:08 UTC 2011




----- Original Nachricht ----
Von:     Bináris <wikiposta at gmail.com>
An:      Pywikipedia discussion list <pywikipedia-l at lists.wikimedia.org>
Datum:   25.02.2011 15:16
Betreff: [Pywikipedia-l] Two minor problems in replace.py (attn xqt)

> Hi!
> 
> In replace.py, current version 8920, line 444:
> if not page.canBeEdited():
> should change to
> if not self.articles and not page.canBeEdited():

OK


> 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?

I tried it in idle:

>>> append = True
>>> (lambda x: x and 'a' or 'w')(append)
'a'
>>> append = False
>>> (lambda x: x and 'a' or 'w')(append)
'w'
>>> 

Greetings
xqt



More information about the Pywikipedia-l mailing list