Revision: 4932 Author: rotem Date: 2008-01-24 17:28:11 +0000 (Thu, 24 Jan 2008)
Log Message: ----------- (feature request 1876121) Page.fullVersionHistory now returns the revision ID, too. Also, using named groups.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-01-24 17:02:03 UTC (rev 4931) +++ trunk/pywikipedia/wikipedia.py 2008-01-24 17:28:11 UTC (rev 4932) @@ -1840,10 +1840,9 @@ """ Return all previous versions including wikitext.
- Gives a list of tuples consisting of edit date/time, user name and + Gives a list of tuples consisting of revision ID, edit date/time, user name and content """ - # TODO: probably should return revision id, as well. address = self.site().export_address() predata = { 'action': 'submit', @@ -1863,11 +1862,12 @@ get_throttle.setDelay(time.time() - now) output = [] # TODO: parse XML using an actual XML parser instead of regex! - r = re.compile("<revision>.*?<timestamp>(.*?)</timestamp>.*?<(?:ip|username)>(.*?)</(?:ip|username)>.*?<text.*?>(.*?)</text>",re.DOTALL) + r = re.compile("<revision>.*?<id>(?P<id>.*?)</id>.*?<timestamp>(?P<timestamp>.*?)</timestamp>.*?<(?:ip|username)>(?P<user>.*?)</(?:ip|username)>.*?<text.*?>(?P<content>.*?)</text>",re.DOTALL) #r = re.compile("<revision>.*?<timestamp>(.*?)</timestamp>.*?<(?:ip|username)>(.*?)<",re.DOTALL) - return [ (match.group(1), - unescape(match.group(2)), - unescape(match.group(3))) + return [ (match.group('id'), + match.group('timestamp'), + unescape(match.group('user')), + unescape(match.group('content'))) for match in r.finditer(data) ]
def contributingUsers(self):
pywikipedia-l@lists.wikimedia.org