[Pywikipedia-svn] SVN: [7265] branches/rewrite/scripts/imageuncat.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Thu Sep 17 14:45:05 UTC 2009
Revision: 7265
Author: nicdumz
Date: 2009-09-17 14:45:05 +0000 (Thu, 17 Sep 2009)
Log Message:
-----------
use Site.getcurrenttime() instead of datetime.utcnow(), to retrieve a
pywikibot.Timestamp directly: the API methods expect Timestamp objects,
not datetime objects
Modified Paths:
--------------
branches/rewrite/scripts/imageuncat.py
Modified: branches/rewrite/scripts/imageuncat.py
===================================================================
--- branches/rewrite/scripts/imageuncat.py 2009-09-17 14:28:52 UTC (rev 7264)
+++ branches/rewrite/scripts/imageuncat.py 2009-09-17 14:45:05 UTC (rev 7265)
@@ -1270,37 +1270,11 @@
Should probably copied to somewhere else
'''
- result = []
- dateformat ="%Y-%m-%dT%H:%M:%SZ"
- rcstart = datetime.utcnow() + timedelta(minutes=-delay-block)
- rcend = datetime.utcnow() + timedelta(minutes=-delay)
+ rcstart = site.getcurrenttime() + timedelta(minutes=-delay-block)
+ rcend = site.getcurrenttime() + timedelta(minutes=-delay)
return site.recentchanges(start=rcstart, end=rcend, reverse=True, namespaces=6, changetype='edit|log', showBot=False)
- '''
- params = {
- 'action' :'query',
- 'list' :'recentchanges',
- 'rcstart' :rcstart.strftime(dateformat),
- 'rcend' :rcend.strftime(dateformat),
- 'rcdir' :'newer',
- 'rcnamespace':'6',
- 'rcprop' :'title',
- 'rcshow' :'!bot',
- 'rclimit' :'5000',
- 'rctype' :'edit|log',
- }
- data = query.GetData(params, site, encodeTitle = False)
- try:
- for item in data['query']['recentchanges']:
- result.append(item['title'])
- except IndexError:
- raise NoPage(u'API Error, nothing found in the APIs')
- except KeyError:
- raise NoPage(u'API Error, nothing found in the APIs')
-
- return pagegenerators.PagesFromTitlesGenerator(result, site)
- '''
def isUncat(page):
'''
Do we want to skip this page?
More information about the Pywikipedia-svn
mailing list