Revision: 8112 Author: alexsh Date: 2010-04-18 20:05:45 +0000 (Sun, 18 Apr 2010)
Log Message: ----------- fix data dump loop"
Modified Paths: -------------- trunk/pywikipedia/welcome.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/welcome.py =================================================================== --- trunk/pywikipedia/welcome.py 2010-04-18 19:48:48 UTC (rev 8111) +++ trunk/pywikipedia/welcome.py 2010-04-18 20:05:45 UTC (rev 8112) @@ -689,22 +689,21 @@
count_auto = 0 wikipedia.output("Querying new user log from API....") - while True: - for x in self.site.logpages(number = int(globalvar.queryLimit), mode = 'newusers',start = starttime, dump = True): - someone_found = True - if 'user' not in x: - continue - #created twice? - if not globalvar.welcomeAuto and x['action'] == 'create2': - continue - if not globalvar.welcomeAuto and x['action'] == 'autocreate': - if not globalvar.quick: - showStatus(3) - wikipedia.output(u'%s has been created automatically.' % x['user']) - count_auto += 1 - continue + for x in self.site.logpages(number = globalvar.queryLimit, mode = 'newusers',start = starttime, dump = True): + someone_found = True + if 'user' not in x: + continue + #created twice? + if not globalvar.welcomeAuto and x['action'] == 'create2': + continue + if not globalvar.welcomeAuto and x['action'] == 'autocreate': + if not globalvar.quick: + showStatus(3) + wikipedia.output(u'%s has been created automatically.' % x['user']) + count_auto += 1 + continue
- yield userlib.User(self.site, x['user']) + yield userlib.User(self.site, x['user'])
if someone_found: if globalvar.quick and count_auto > 0:
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2010-04-18 19:48:48 UTC (rev 8111) +++ trunk/pywikipedia/wikipedia.py 2010-04-18 20:05:45 UTC (rev 8112) @@ -5732,16 +5732,15 @@ if dump: # dump result only. yield c - continue - - if c['ns'] == 6: - p_ret = ImagePage(self, c['title']) else: - p_ret = Page(self, c['title'], defaultNamespace=c['ns']) - - yield (p_ret, c['user'], - parsetime2stamp(c['timestamp']), - c['comment'], ) + if c['ns'] == 6: + p_ret = ImagePage(self, c['title']) + else: + p_ret = Page(self, c['title'], defaultNamespace=c['ns']) + + yield (p_ret, c['user'], + parsetime2stamp(c['timestamp']), + c['comment'], )
nbresults += 1 if nbresults >= number: