r76980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76979‎ | r76980 | r76981 >
Date:22:49, 18 November 2010
Author:diederik
Status:deferred
Tags:
Comment:
Fixed issue where config value was read but not consequential.
Modified paths:
  • /trunk/tools/editor_trends/config.py (modified) (history)
  • /trunk/tools/editor_trends/configuration.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/config.py
@@ -43,7 +43,7 @@
4444
4545 config.read('wiki.cfg')
4646 settings.working_directory = config.get('file_locations', 'working_directory')
47 - settings.input_location = config.get('file_locations', 'xml_file_location')
 47+ settings.input_location = config.get('file_locations', 'settings.input_location')
4848
4949
5050 def create_configuration(**kwargs):
Index: trunk/tools/editor_trends/configuration.py
@@ -48,7 +48,7 @@
4949 self.encoding = 'utf-8'
5050 self.date_format = '%Y-%m-%d' #Date format as used by Erik Zachte
5151 self.timestamp_format = '%Y-%m-%dT%H:%M:%SZ' # Timestampformat as generated by the MediaWiki dumps
52 -
 52+
5353 self.max_settings_xmlfile_size = 67108864 # ==64Mb, see http://hadoop.apache.org/common/docs/r0.20.0/hdfs_design.html#Large+Data+Setsfor reason
5454 self.number_of_processes = cpu_count() * process_multiplier
5555 #Change this to match your computers configuration (RAM / CPU)
@@ -62,15 +62,15 @@
6363 self.architecture = platform.machine()
6464 self.working_directory = self.determine_working_directory()
6565 self.update_python_path()
66 -
 66+
6767 self.root = '/' if self.platform != 'Windows' else 'c:\\'
6868 self.ziptool = self.determine_ziptool()
6969 self.file_locations = self.set_file_locations()
7070 self.max_filehandles = self.determine_max_filehandles_open()
71 -
72 - self.windows_register= {'7zip': 'Software\\7-Zip',}
7371
74 - self.projects= {'commons': 'commonswiki',
 72+ self.windows_register = {'7zip': 'Software\\7-Zip', }
 73+
 74+ self.projects = {'commons': 'commonswiki',
7575 'wikibooks': 'wikibooks',
7676 'wikinews': 'wikinews',
7777 'wikiquote': 'wikiquote',
@@ -88,24 +88,21 @@
8989 'multilingual wikisource': None
9090 }
9191
92 -
 92+
9393 def determine_working_directory(self):
9494 cwd = os.getcwd()
9595 if not cwd.endswith('editor_trends%s' % os.sep):
9696 pos = cwd.find('editor_trends') + 14
9797 cwd = cwd[:pos]
9898 return cwd
99 -
 99+
100100 def determine_platform(self):
101 - #Setting up the environment
102 - ops = {platform.win32_ver: 'Windows',
103 - platform.linux_distribution: 'Linux',
104 - platform.mac_ver: 'OSX'}
105 - for op in ops:
106 - if op() != ('', '', '') and op() != ('', ('', '', ''), ''):
107 - return ops[op]
108 - return None
109 -
 101+ os = platform.system()
 102+ if os == 'Darwin':
 103+ return 'OSX'
 104+ else:
 105+ return os
 106+
110107 def verify_environment(self, directories):
111108 for dir in directories:
112109 result = os.path.exists(dir)
@@ -114,7 +111,7 @@
115112 os.mkdir(dir)
116113 except IOError:
117114 raise 'Configuration Error, could not create directory.'
118 -
 115+
119116 def detect_windows_program(self, program):
120117 entry = self.windows_register[program]
121118 try:
@@ -130,7 +127,7 @@
131128 return path
132129 else:
133130 raise NotImplementedError
134 -
 131+
135132 def determine_max_filehandles_open(self):
136133 if self.platform == 'Windows' and self.architecture == 'i386':
137134 return win32file._getmaxstdio()

Status & tagging log