[Pywikipedia-l] Strange behavior of wikipedia.py when protecting a page

Bináris wikiposta at gmail.com
Thu Aug 19 21:59:06 UTC 2010


The idea is to create a user page and a talk page for a blocked user with a
template, and immediately after creating to protect them.

The bot creates the pages and gives an error:
Creating page [[Szerkesztö:SZDSZ]] via API
Sleeping for 6.7 seconds, 2010-08-19 23:04:37
Creating page [[Szerkesztövita:SZDSZ]] via API
Note: Your sysop account on wikipedia:hu does not have a bot flag. Its edits
wil
l be visible in the recent changes.
Sleeping for 4.8 seconds, 2010-08-19 23:04:49
Do you want to change the protection level of [[hu:Szerkesztö:SZDSZ]]?
([Y]es, [
N]o, [A]ll) a
{u'error': {u'info': u"*Existing titles can't be protected with 'create'*",
u'code
': u'create-titleexists'}}
Sleeping for 6.9 seconds, 2010-08-19 23:04:57
{u'error': {u'info': u"Existing titles can't be protected with 'create'",
u'code
': u'create-titleexists'}}
Now comes the funny thing: I run the script again. It saves the page with
the same text (of course, this will not appear in page history), and now it
protects the pages successfully!
Updating page [[Szerkesztö:SZDSZ]] via API
Sleeping for 7.9 seconds, 2010-08-19 23:14:28
Updating page [[Szerkesztövita:SZDSZ]] via API
Note: Your sysop account on wikipedia:hu does not have a bot flag. Its edits
wil
l be visible in the recent changes.
Sleeping for 8.9 seconds, 2010-08-19 23:14:37
Do you want to change the protection level of [[hu:Szerkesztö:SZDSZ]]?
([Y]es, [
N]o, [A]ll) a
Changed protection level of page [[Szerkesztö:SZDSZ]].
Sleeping for 7.1 seconds, 2010-08-19 23:14:49
Changed protection level of page [[Szerkesztövita:SZDSZ]].
How is it possible that the second time the pages could be protected,
although they were existing titles, too?
I tried to change the order of script lines: first protection, and saving
afterwards. This works!  But this way the bot creates the pages under my
sysop name, because they are already protected.

I just have used the lines:
        userlap.protect(reason=self.summary)
        vitalap.protect(reason=self.summary)
In wikipedia.py protection stands as follows:
def protect(self, editcreate = 'sysop', move = 'sysop', etc.
So it has only a common "editcreate" parameter.
Please help, what is wrong in my solution, and how is it possible, that
first time a page cannot be protected, and the second time it can?


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


More information about the Pywikipedia-l mailing list