Page MenuHomePhabricator

Welcome script fails to get translated log header
Closed, ResolvedPublic

Description

Recently the welcome script failed on Travis: https://travis-ci.org/wikimedia/pywikibot-core/jobs/58246884#L756 As that output is a bit unwieldy here is the output easier to read:

[NoAct]  ***Ahmed abssi has no contributions.
[Match]  ***Brahhhimm has enough edits to be welcomed.
WARNING: /home/travis/build/wikimedia/pywikibot-core/pywikibot/family.py:916: FamilyMaintenanceWarning: Family name wikimediachapter does not match family module name wikimedia
SIMULATION: edit action blocked. ***
Page [[نقاش المستخدم:Brahhhimm]] saved
[Done ]  ***One user has been welcomed.
[NoAct]  ***Hosnymansor has no contributions.
[NoAct]  ***Bilal chafi has no contributions.
[NoAct]  ***Ridouan al hannachi has no contributions.
[NoAct]  ***Techno oussama has no contributions.
[NoAct]  ***سلمان عبدالرحمن موسى خبش has no contributions.
[NoAct]  ***أحمد عامر المطارنة has no contributions.
[NoAct]  ***ويكي 000 has no contributions.
[NoAct]  ***Djoukeng Borel has no contributions.
[NoAct]  ***ArameaWiki has no contributions.
[NoAct]  ***Mjno0onk has no contributions.
[NoAct]  ***Abdulrmomin has no contributions.
[NoAct]  ***Amdsab has no contributions.
[NoAct]  ***WINNERS05 has no contributions.
[NoAct]  ***Super-hicham has no contributions.
[NoAct]  ***Badr salhi has no contributions.
[NoAct]  ***Amin osx has no contributions.
[NoAct]  ***Mohamed tahirii has no contributions.
[NoAct]  ***Sami almadhgi has no contributions.
[NoAct]  ***Wildtunis has no contributions.
[Match]  ***Achway has enough edits to be welcomed.
[Skip ]  ***Achway has been already welcomed.
[NoAct]  ***Anas x-love has no contributions.
[NoAct]  ***Cloracefmr has no contributions.
[NoAct]  ***Hamza halhoul has no contributions.
[NoAct]  ***Osama Alzoubi has no contributions.
[NoAct]  ***Ayoub malloul has no contributions.
[NoAct]  ***Turki althakafi has no contributions.
[NoAct]  ***7assiba has no contributions.
[NoAct]  ***El Ouakili has no contributions.
[NoAct]  ***TAREQ ESAM HAMMAD has no contributions.
[NoAct]  ***Jin dido has no contributions.
[NoAct]  ***Argentumbolo has no contributions.
[NoAct]  ***I'm so meta even this acronym has no contributions.
[NoAct]  ***Ikmalsyafiq has no contributions.
[NoAct]  ***Talal RH has no contributions.
[NoAct]  ***ابواياد5886 has no contributions.
[NoAct]  ***Malobaid has no contributions.
[Match]  ***John Vandenberg has enough edits to be welcomed.
[Skip ]  ***John Vandenberg has been already welcomed.
[NoAct]  ***XZise has no contributions.
[NoAct]  ***MZERYOH has no contributions.
[NoAct]  ***Aboomara1972 has no contributions.
[NoAct]  ***Wå Lîî Døx has no contributions.
[NoAct]  ***Ejs-80 has no contributions.
[NoAct]  ***Luke081515 has no contributions.
[NoAct]  ***سمو البدر 502 has no contributions.
[NoAct]  ***MjdBashrahel has no contributions.
[NoAct]  ***Mohammed fanatsah has no contributions.
[Skip ]  ***دائرة المعارف القانونية has been blocked!
[NoAct]  ***Latifa iman has no contributions.
[MSG  ]  ***Putting the log of the latest user...
[MSG  ]  ***Log page is not exist, getting information for page creation
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot-core/pwb.py", line 215, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "/home/travis/build/wikimedia/pywikibot-core/pwb.py", line 84, in run_python_file
    main_mod.__dict__)
  File "./scripts/welcome.py", line 1017, in <module>
    main()
  File "./scripts/welcome.py", line 998, in main
    bot.run()
  File "./scripts/welcome.py", line 831, in run
    if self.makelogpage(self.welcomed_users):
  File "./scripts/welcome.py", line 661, in makelogpage
    text += u'\n!%s' % self.site.namespace(2)
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'unicode'
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

So text is None and looking into the code reveals that it translates it using the site's language and a fixed logpage_header table.

text = i18n.translate(self.site, logpage_header)
text += u'\n!%s' % self.site.namespace(2)

And logpage_header has only the keys _default, no and it and without fallback set to True it won't use _default. Interestingly I can't find any recent changes that would've lead to this problem (e.g. fallback parameter removed).

Event Timeline

XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
XZise added a project: Pywikibot.
XZise added subscribers: XZise, Ladsgroup.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptApr 13 2015, 5:51 PM

Ah, okay the relevant code was directly copied from compat in e500504d and compat does use fallback=True by default. Not sure why Pywikibot is using False by default though.

Change 203942 had a related patch set uploaded (by XZise):
[FIX] welcome: Fallback for i18n translate

https://gerrit.wikimedia.org/r/203942

Change 203942 merged by jenkins-bot:
[FIX] welcome: Fallback for i18n translate

https://gerrit.wikimedia.org/r/203942

jayvdb claimed this task.

Change 206812 had a related patch set uploaded (by Xqt):
"[FIX] welcome: Fallback for i18n translate""

https://gerrit.wikimedia.org/r/206812

Xqt subscribed.

Reopened due to bug T97291

Change 206812 merged by jenkins-bot:
[FIX] welcome: Fallback for i18n translate

https://gerrit.wikimedia.org/r/206812

jayvdb reassigned this task from jayvdb to XZise.
jayvdb set Security to None.