Page MenuHomePhabricator

send_email returns False when successful
Closed, ResolvedPublic

Description

An email is successfully sent and received when using

>>> pywikibot.User(pywikibot.Site('en', 'wikipedia'), 'JJMC89').send_email('test subject', 'test body')
False

but send_email incorrectly returns False.


Pywikibot: [https] r-pywikibot-core.git (ee68ee6, g1, 2017/07/22, 07:32:02, n/a)
Release version: 3.0-dev
requests version: 2.2.1
  cacerts: /etc/ssl/certs/ca-certificates.crt
    certificate test: ok
Python: 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4]

Event Timeline

Dalba triaged this task as Medium priority.EditedJul 24 2017, 5:45 AM
Dalba added subscribers: Anomie, Dalba.

It seems that API is returning {"emailuser":{"result":"Warnings"}} as response. The expected response is {"emailuser":{"result":"Success"}}. I don't know what that Warnings means here.

I tried to send the request manually (using requests and API directly), but got the same warning. Maybe an API guru can help, @Anomie ?

Change 367472 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] ApiEmailUser: Add parentheses to fix output

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

It's a bug in the API, due to the fact that PHP's ternary operator is stupidly left-associative.

Change 367472 merged by jenkins-bot:
[mediawiki/core@master] ApiEmailUser: Add parentheses to fix output

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

The fix should be deployed with 1.30.0-wmf.11, see https://www.mediawiki.org/wiki/MediaWiki_1.30/Roadmap for the schedule.

If it's needed faster, feel free to submit it for SWAT.