Index: trunk/tools/editor_trends/utils/inventory.py |
— | — | @@ -28,7 +28,9 @@ |
29 | 29 | |
30 | 30 | from database import db |
31 | 31 | 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 |
33 | 35 | |
34 | 36 | class AnchorParser(HTMLParser): |
35 | 37 | ''' |
— | — | @@ -109,7 +111,9 @@ |
110 | 112 | |
111 | 113 | |
112 | 114 | def launcher(): |
113 | | - properties = wikiprojects.Wiki(settings) |
| 115 | + project = projects.init() |
| 116 | + language = languages.init() |
| 117 | + properties = runtime_settings.RunTimeSettings(project, language, settings) |
114 | 118 | dumpers = [] |
115 | 119 | for project in properties.projects: |
116 | 120 | if project == 'wiki': |
Index: trunk/tools/editor_trends/utils/file_utils.py |
— | — | @@ -215,20 +215,23 @@ |
216 | 216 | |
217 | 217 | |
218 | 218 | def delete_file(location, filename, directory=False): |
| 219 | + res = True |
219 | 220 | if not directory: |
220 | 221 | if check_file_exists(location, filename): |
221 | 222 | try: |
222 | 223 | path = os.path.join(location, filename) |
223 | 224 | os.remove(path) |
224 | 225 | except WindowsError, error: |
| 226 | + res = False |
225 | 227 | print error |
226 | 228 | else: |
227 | 229 | try: |
228 | 230 | shutil.rmtree(location) |
229 | 231 | except Exception, error: |
| 232 | + res = False |
230 | 233 | print error |
| 234 | + return res |
231 | 235 | |
232 | | - |
233 | 236 | def determine_filesize(location, filename): |
234 | 237 | path = os.path.join(location, filename) |
235 | 238 | return os.path.getsize(path) |
Index: trunk/tools/editor_trends/utils/http_utils.py |
— | — | @@ -76,8 +76,10 @@ |
77 | 77 | else: |
78 | 78 | print 'Added chunk to download: %s' % f |
79 | 79 | 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) |
82 | 84 | return task_queue |
83 | 85 | |
84 | 86 | |
Index: trunk/tools/editor_trends/utils/log.py |
— | — | @@ -38,8 +38,8 @@ |
39 | 39 | if job == None: |
40 | 40 | if jobtype == 'dataset': |
41 | 41 | _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, |
44 | 44 | 'in_progress': True, 'jobtype': jobtype, |
45 | 45 | 'tasks': {}}) |
46 | 46 | |