r85607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85606‎ | r85607 | r85608 >
Date:02:01, 7 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Additional debug messages
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -644,6 +644,7 @@
645645 article['revisions'] = []
646646 elements = []
647647 id = False
 648+ ns = False
648649
649650 try:
650651 for event, elem in context:
@@ -651,6 +652,7 @@
652653 xml_namespace = determine_xml_namespace(elem)
653654 namespaces = create_namespace_dict(elem, xml_namespace)
654655 article['namespaces'] = namespaces
 656+ ns = True
655657 elif event == 'end' and elem.tag.endswith('title'):
656658 article['title'] = elem
657659 elif event == 'end' and elem.tag.endswith('revision'):
@@ -665,11 +667,8 @@
666668 article['revisions'] = []
667669 article['namespaces'] = namespaces
668670 id = False
669 - elements = [elem.clear() for elem in elements]
670 - elements = []
671 - elif event == 'end':
672 - elements.append(elem)
673 -
 671+ elif event == 'end' and ns == True:
 672+ elem.clear()
674673 except SyntaxError, error:
675674 print 'Encountered invalid XML tag. Error message: %s' % error
676675 dump(elem)