r84800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84799‎ | r84800 | r84801 >
Date:15:19, 26 March 2011
Author:diederik
Status:deferred
Tags:
Comment:
Added some try / except clauses to catch edge cases.
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -382,7 +382,11 @@
383383 def parse_xml(buffer):
384384 context = iterparse(buffer, events=('end',))
385385 context = iter(context)
386 - event, root = context.next()
 386+ try:
 387+ event, root = context.next()
 388+ except SyntaxError, e:
 389+ print e
 390+ print buffer.getvalue()
387391
388392 article = {}
389393 id = False
@@ -436,7 +440,8 @@
437441 if dataset == 'training':
438442 function(article, cache, bots)
439443 else:
440 - counts = function(article, counts, bots)
 444+ #counts = function(article, counts, bots)
 445+ pass
441446 buffer = cStringIO.StringIO()
442447
443448 if i % 10000 == 0:

Status & tagging log