http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76346

Revision: 76346
Author:   diederik
Date:     2010-11-08 22:18:46 +0000 (Mon, 08 Nov 2010)
Log Message:
-----------
Quick fix.

Modified Paths:
--------------
    trunk/tools/editor_trends/map_wiki_editors.py

Modified: trunk/tools/editor_trends/map_wiki_editors.py
===================================================================
--- trunk/tools/editor_trends/map_wiki_editors.py       2010-11-08 22:12:49 UTC 
(rev 76345)
+++ trunk/tools/editor_trends/map_wiki_editors.py       2010-11-08 22:18:46 UTC 
(rev 76346)
@@ -124,7 +124,6 @@
                 for head in headers:
                     data.append(vars[head])
                 utils.write_list_to_csv(data, output)
-                output.write('\n')
         vars = {}
 
 
@@ -139,7 +138,9 @@
     
     Output is the data_queue that will be used by store_editors() 
     '''
-    file_location = os.path.join(settings.XML_FILE_LOCATION, 
kwargs.get('language', 'en'), kwargs.get('project', 'wiki'))
+    input = os.path.join(settings.XML_FILE_LOCATION, kwargs.get('language', 
'en'), kwargs.get('project', 'wiki'))
+    output = os.path.join(input, 'txt')
+    utils.create_directory(output)
     debug = kwargs.get('debug', False)
     destination = kwargs.get('destination', 'file')
     
@@ -157,12 +158,12 @@
                 print 'Swallowed a poison pill'
                 break
 
-            data = xml.read_input(utils.create_txt_filehandle(file_location,
+            data = xml.read_input(utils.create_txt_filehandle(input,
                                                       file, 'r',
                                                       
encoding=settings.ENCODING))
             if destination == 'file':
                 name = file[:-4] + '.txt'
-                output = utils.create_txt_filehandle(file_location, name, 'w', 
settings.ENCODING)
+                fh = utils.create_txt_filehandle(output, name, 'w', 
settings.ENCODING)
             for raw_data in data:
                 xml_buffer = cStringIO.StringIO()
                 raw_data.insert(0, '<?xml version="1.0" encoding="UTF-8" ?>\n')
@@ -171,7 +172,7 @@
                     raw_data = ''.join(raw_data)
                     xml_buffer.write(raw_data)
                     elem = cElementTree.XML(xml_buffer.getvalue())
-                    output_editor_information(elem, output, bots=bots, 
destination=destination)
+                    output_editor_information(elem, fh, bots=bots, 
destination=destination)
                 except SyntaxError, error:
                     print error
                     '''


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to