r81109 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81108‎ | r81109 | r81110 >
Date:23:32, 27 January 2011
Author:diederik
Status:deferred
Tags:
Comment:
Minor improvements
Modified paths:
  • /trunk/tools/editor_trends/utils/file_utils.py (modified) (history)
  • /trunk/tools/editor_trends/utils/http_utils.py (modified) (history)
  • /trunk/tools/editor_trends/utils/inventory.py (modified) (history)
  • /trunk/tools/editor_trends/utils/log.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/utils/inventory.py
@@ -28,7 +28,9 @@
2929
3030 from database import db
3131 from utils import http_utils
32 -from classes import wikiprojects
 32+from classes import runtime_settings
 33+from classes import languages
 34+from classes import projects
3335
3436 class AnchorParser(HTMLParser):
3537 '''
@@ -109,7 +111,9 @@
110112
111113
112114 def launcher():
113 - properties = wikiprojects.Wiki(settings)
 115+ project = projects.init()
 116+ language = languages.init()
 117+ properties = runtime_settings.RunTimeSettings(project, language, settings)
114118 dumpers = []
115119 for project in properties.projects:
116120 if project == 'wiki':
Index: trunk/tools/editor_trends/utils/file_utils.py
@@ -215,20 +215,23 @@
216216
217217
218218 def delete_file(location, filename, directory=False):
 219+ res = True
219220 if not directory:
220221 if check_file_exists(location, filename):
221222 try:
222223 path = os.path.join(location, filename)
223224 os.remove(path)
224225 except WindowsError, error:
 226+ res = False
225227 print error
226228 else:
227229 try:
228230 shutil.rmtree(location)
229231 except Exception, error:
 232+ res = False
230233 print error
 234+ return res
231235
232 -
233236 def determine_filesize(location, filename):
234237 path = os.path.join(location, filename)
235238 return os.path.getsize(path)
Index: trunk/tools/editor_trends/utils/http_utils.py
@@ -76,8 +76,10 @@
7777 else:
7878 print 'Added chunk to download: %s' % f
7979 task_queue.put(f)
80 - for x in xrange(settings.number_of_processes):
81 - task_queue.put(None)
 80+ if x < settings.number_of_processes:
 81+ settings.number_of_processes = x
 82+ for x in xrange(settings.number_of_processes):
 83+ task_queue.put(None)
8284 return task_queue
8385
8486
Index: trunk/tools/editor_trends/utils/log.py
@@ -38,8 +38,8 @@
3939 if job == None:
4040 if jobtype == 'dataset':
4141 _id = coll.save({'hash': hash, 'created': created, 'finished': False,
42 - 'language_code': properties.language_code,
43 - 'project': properties.short_project,
 42+ 'language_code': properties.language.code,
 43+ 'project': properties.project.name,
4444 'in_progress': True, 'jobtype': jobtype,
4545 'tasks': {}})
4646

Status & tagging log