Try to check if the pattern is valid.

see #289
This commit is contained in:
Antoine Nguyen
2013-06-12 09:54:45 +02:00
parent cb48f2ecd7
commit 6325292a89
+8
View File
@@ -207,6 +207,14 @@ class GeneralParametersForm(parameters.AdminParametersForm):
del self.fields["handle_mailboxes"]
del self.fields["mailboxes_owner"]
def clean_ldap_user_dn_template(self):
tpl = self.cleaned_data["ldap_user_dn_template"]
try:
test = tpl % {"user": "toto"}
except ValueError:
raise forms.ValidationError(_("Invalid syntax"))
return tpl
def clean(self):
"""Custom validation method