def bulk_validate_file(result_id, **kw): res = ValidationResult.objects.get(pk=result_id) task_error = None validation = None file_base = os.path.basename(res.file.file_path) try: log.info('[1@None] Validating file %s (%s) for result_id %s' % (res.file, file_base, res.id)) target = res.validation_job.target_version guid = amo.APP_IDS[target.application].guid ver = {guid: [target.version]} # Set min/max so the validator only tests for compatibility with # the target version. Note that previously we explicitly checked # for compatibility with older versions. See bug 675306 for # the old behavior. overrides = {'targetapp_minVersion': {guid: target.version}, 'targetapp_maxVersion': {guid: target.version}} validation = run_validator(res.file.file_path, for_appversions=ver, test_all_tiers=True, overrides=overrides, compat=True) except: task_error = sys.exc_info() log.exception( u'bulk_validate_file exception on file {} ({})' .format(res.file, file_base)) res.completed = datetime.now() if task_error: res.task_error = ''.join(traceback.format_exception(*task_error)) else: res.apply_validation(validation) log.info('[1@None] File %s (%s) errors=%s' % (res.file, file_base, res.errors)) res.save() tally_job_results(res.validation_job.id)