http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10269
Revision: 10269 Author: xqt Date: 2012-06-02 22:33:14 +0000 (Sat, 02 Jun 2012) Log Message: ----------- isAllowed('sendemail') exists since 1.16, bugfix for bug #3526073
Modified Paths: -------------- trunk/pywikipedia/userlib.py
Modified: trunk/pywikipedia/userlib.py =================================================================== --- trunk/pywikipedia/userlib.py 2012-06-02 20:07:26 UTC (rev 10268) +++ trunk/pywikipedia/userlib.py 2012-06-02 22:33:14 UTC (rev 10269) @@ -179,7 +179,7 @@ return pywikibot.Page(self.site(), self.name() + subpage, defaultNamespace=3)
- def sendMail(self, subject=u'', text=u'', ccMe = False): + def sendMail(self, subject=u'', text=u'', ccMe=False): """ Send an email to this user via mediawiki's email interface. Return True on success, False otherwise. This method can raise an UserActionRefuse exception in case this user @@ -192,10 +192,12 @@ @type text: unicode @param ccme: if True, sends a copy of this email to the bot @type ccme: bool + """ if not self.isEmailable(): raise UserActionRefuse('This user is not mailable') - if not self.site().isAllowed('sendemail'): + if self.site().versionnumber() >= 16 and \ + not self.site().isAllowed('sendemail'): raise UserActionRefuse('You don't have permission to send mail')
if not self.site().has_api() or self.site().versionnumber() < 14: