Commit 27a4d34a authored by Michal Čihař's avatar Michal Čihař

Add template validation

parent f8aa80c5
......@@ -460,6 +460,16 @@ class SubProject(models.Model):
if len(errors) > 0:
raise ValidationError(_('Failed to parse %d matched files!') % len(errors))
# Validate template
if self.template != '':
template = os.path.join(self.get_path(), self.template)
try:
factory.getobject(os.path.join(self.get_path(), match))
except ValueError:
raise ValidationError(_('Format of translation template could not be recognized.'))
except Exception, e:
raise ValidationError(_('Failed to parse translation template.'))
def save(self, *args, **kwargs):
'''
Save wrapper which updates backend Git repository and regenerates
......
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