http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10849
Revision: 10849 Author: xqt Date: 2012-12-30 15:10:49 +0000 (Sun, 30 Dec 2012) Log Message: ----------- new articlefeedback log mode, new offset parameter for logpages means offset hours from now.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2012-12-30 14:12:30 UTC (rev 10848) +++ trunk/pywikipedia/wikipedia.py 2012-12-30 15:10:49 UTC (rev 10849) @@ -6775,14 +6775,16 @@
# TODO: avoid code duplication for the following methods
- def logpages(self, number = 50, mode = '', title = None, user = None, repeat = False, - namespace = [], start = None, end = None, tag = None, newer = False, dump = False): + def logpages(self, number=50, mode='', title=None, user=None, repeat=False, + namespace=[], start=None, end=None, tag=None, newer=False, + dump=False, offset=None):
if not self.has_api() or self.versionnumber() < 11 or \ mode not in ('block', 'protect', 'rights', 'delete', 'upload', 'move', 'import', 'patrol', 'merge', 'suppress', 'review', 'stable', 'gblblock', 'renameuser', - 'globalauth', 'gblrights', 'abusefilter', 'newusers'): + 'globalauth', 'gblrights', 'abusefilter', + 'articlefeedbackv5', 'newusers'): raise NotImplementedError, mode params = { 'action' : 'query', @@ -6790,7 +6792,8 @@ 'letype' : mode, 'lelimit' : int(number), 'ledir' : 'older', - 'leprop' : ['ids', 'title', 'type', 'user', 'timestamp', 'comment', 'details',], + 'leprop' : ['ids', 'title', 'type', 'user', 'timestamp', + 'comment', 'details',], }
if number > config.special_page_limit: @@ -6805,6 +6808,14 @@ params['letitle'] = title if start: params['lestart'] = start + if offset and offset > 0: + output(u'WARNING: offset parameter %s ignored,\n' + u' start parameter is set to %s' + % (offset, start)) + # offset in hours from now + elif offset and offset > 0: + start = Timestamp.utcnow() - datetime.timedelta(0, offset*3600) + params['lestart'] = str(start) if end: params['leend'] = end if tag and self.versionnumber() >= 16: # tag support from mw:r58399
pywikipedia-svn@lists.wikimedia.org