Revision: 5053 Author: rotem Date: 2008-02-19 16:29:20 +0000 (Tue, 19 Feb 2008)
Log Message: ----------- (bug 1896539) Add a Site.messages method.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-02-19 14:48:25 UTC (rev 5052) +++ trunk/pywikipedia/wikipedia.py 2008-02-19 16:29:20 UTC (rev 5053) @@ -668,11 +668,6 @@ if text.find("<title>Wiki does not exist</title>") != -1: raise NoSuchSite(u'Wiki %s does not exist yet' % self.site())
- #Check for new messages - if '<div class="usermessage">' in text: - self.site().messages=True - else: - self.site().messages=False # Extract the actual text from the textarea m1 = re.search('<textarea([^>]*)>', text) m2 = re.search('</textarea>', text) @@ -3834,6 +3829,12 @@ index = self._userIndex(sysop) return right in self._rights[index]
+ def messages(self, sysop = False): + """Returns true if the user has new messages, and false otherwise.""" + self._load(sysop = sysop) + index = self._userIndex(sysop) + return self._messages[index] + def cookies(self, sysop = False): """Return a string containing the user's current cookies.""" self._loadCookies(sysop = sysop)
pywikipedia-l@lists.wikimedia.org