Commit f8aa80c5 authored by Michal Čihař's avatar Michal Čihař

Catch also other (parse) errors while validaating

parent b12c1e4e
......@@ -446,14 +446,19 @@ class SubProject(models.Model):
langs[code] = match
# Try parsing files
failures = []
notrecognized = []
errors = []
for match in matches:
try:
factory.getobject(os.path.join(self.get_path(), match))
except ValueError:
failures.append(match)
if len(failures) > 0:
raise ValidationError(_('Format of %d matched files could not be recognized.') % len(failures))
notrecognized.append(match)
except Exception, e:
errors.append(str(e))
if len(notrecognized) > 0:
raise ValidationError(_('Format of %d matched files could not be recognized.') % len(notrecognized))
if len(errors) > 0:
raise ValidationError(_('Failed to parse %d matched files!') % len(errors))
def save(self, *args, **kwargs):
'''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment