r85646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85645‎ | r85646 | r85647 >
Date:21:49, 7 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Fixed issue where sometimes output was not written to file.
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -35,9 +35,6 @@
3636 from analyses.adhoc import bot_detector
3737 from utils import file_utils
3838
39 -filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
40 - 'utf-8') for fh in xrange(rts.max_filehandles)]
41 -
4239 EXCLUDE_NAMESPACE = {
4340 #0:'Main',
4441 #1:'Talk',
@@ -656,8 +653,8 @@
657654 article['revisions'] = []
658655 article['namespaces'] = namespaces
659656 id = False
660 - elif event == 'end' and ns == True:
661 - elem.clear()
 657+ #elif event == 'end' and ns == True:
 658+ # elem.clear()
662659 except SyntaxError, error:
663660 print 'Encountered invalid XML tag. Error message: %s' % error
664661 dump(elem)
@@ -668,8 +665,8 @@
669666 bots = bot_detector.retrieve_bots(rts.language.code)
670667 path = os.path.join(rts.output_location, 'txt')
671668
672 - #filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
673 - # 'utf-8') for fh in xrange(rts.max_filehandles)]
 669+ filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
 670+ 'utf-8') for fh in xrange(rts.max_filehandles)]
674671
675672 title_file = os.path.join(path, 'titles.csv')
676673 comment_file = os.path.join(path, 'comments.csv')