[Pywikipedia-l] [ pywikipediabot-Bugs-1966402 ] wrong mediawiki_message when not using the default site lang

SourceForge.net noreply at sourceforge.net
Sun May 18 14:56:30 UTC 2008


Bugs item #1966402, was opened at 2008-05-18 12:18
Message generated for change (Comment added) made by nicdumz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1966402&group_id=93107

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 8
Private: No
Submitted By: Nightshadow28 (nightshadow28)
Assigned to: NicDumZ — Nicolas Dumazet (nicdumz)
Summary: wrong mediawiki_message when not using the default site lang

Initial Comment:
Category.py aborts at full-protection page.

[[w:ja:中田譲治]] is under full-protection, but if category.py tries to edit the article, bot will abort with following massage:

Changing page [[ja:中田譲治]]
ERROR: Unexpected response from wiki server.
       200 (OK)
(HTML)

Dumping to category.dump.bz2, please wait...
Traceback (most recent call last):
  File "category.py", line 945, in ?
    bot.run()
  File "category.py", line 432, in run
    inPlace=self.inPlace)
  File "/home/tatsujin/pywikipedia/catlib.py", line 473, in change_category
    article.put(text, comment)
  File "/home/tatsujin/pywikipedia/wikipedia.py", line 1262, in put
    newPage, self.site().getToken(sysop = sysop), sysop = sysop)
  File "/home/tatsujin/pywikipedia/wikipedia.py", line 1417, in _putPage
    return self._putPage(text, comment, watchArticle, minorEdit, newPage, token=self.site().getToken(sysop = sysop, getagain = True), newToken = True, sysop = sysop)
  File "/home/tatsujin/pywikipedia/wikipedia.py", line 1487, in _putPage
    raise PageNotSaved
wikipedia.PageNotSaved
-----

r5393 and bot account does not have adminship.

----------------------------------------------------------------------

>Comment By: NicDumZ — Nicolas Dumazet (nicdumz)
Date: 2008-05-18 16:56

Message:
Logged In: YES 
user_id=1963242
Originator: NO

attempted to fix it in r5398. I tried fetching by hand several messages on
several sites with different configurations :
the first run is slow, since it now fetches the quite big
Special:Allmessages, but at least the results match the user language...

Any comments on the fix are welcome, as I'm not sure whether there's a
better way to fix it or not...

----------------------------------------------------------------------

Comment By: Nightshadow28 (nightshadow28)
Date: 2008-05-18 15:19

Message:
Logged In: YES 
user_id=1971526
Originator: YES

> You have set up your interface to use English messages, instead of the
> default Japanese messages, have you ?

Oh! Surely, I have set up English Interface for bot account because I
thought that it might avoid localization problem. And I changed setting to
Japanese Interface, bot succeeded skipping the page with detecting "locked"
status as follows.
-----
Checked for running processes. 1 processes currently running, including
the current process.
Reading dump from category.dump.bz2
Target page Category:東京都出身の人物 already exists!
Getting [[Category:東京都出身の俳優]]...
Getting 1 pages from wikipedia:ja...
Sleeping for 5.2 seconds, 2008-05-18 22:07:29
Changing page [[ja:中田譲治]]
Skipping 中田譲治 because page is locked
Dumping to category.dump.bz2, please wait...
-----

I am sorry to step the land mine... :<

----------------------------------------------------------------------

Comment By: NicDumZ — Nicolas Dumazet (nicdumz)
Date: 2008-05-18 14:06

Message:
Logged In: YES 
user_id=1963242
Originator: NO

I just took a deeper look at result.txt, and now I understand things
better :

var wgUserLanguage = "en";

You have set up your interface to use English messages, instead of the
default Japanese messages, have you ?

Site.mediawiki_message('viewsource') is used to get the localized message
of "view source" to match it against the page content, to know if the page
is fully protected. However, it is simply checking for
http://ja.wikipedia.org/wiki/MediaWiki:Viewsource , and this page is not
wgUserLanguage dependant. It will always print the locale default message.
In our case, it should return "view source", and it returns "wrongly"
"ソースを表示"

This bug is serious. It means that our messages detection is not working
whenever a bot is not using the default site language.

----------------------------------------------------------------------

Comment By: NicDumZ — Nicolas Dumazet (nicdumz)
Date: 2008-05-18 13:53

Message:
Logged In: YES 
user_id=1963242
Originator: NO

Thanks for your report :)

I believe the fact that the page was fully protected was a coincidence
here: I tried, in a python console, putting that same ja: Page, (with the
intern _putPage method) and I got a LockedPage Error, instead of a
PageNotSaved, which seems to indicate that the lock detection mechanism
*is* properly working here.

However, catlib.py::change_category was not catching all the PageNotSaved
exceptions and I fixed that in r5396, meaning that such errors are not
supposed to be reported to the end user anymore.

If you still diagnose that some "Saving page ... failed" messages are
always prompted for a particular type of full edit-protected pages, please,
let us know.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1966402&group_id=93107



More information about the Pywikipedia-l mailing list