Commit fcf2367e by Bach Dániel

firewall: fix MACAddressFormField

parent 8c89de42
...@@ -36,12 +36,12 @@ ipv6_template_re = re.compile(r'^(%\([abcd]\)[dxX]|[A-Za-z0-9:-])+$') ...@@ -36,12 +36,12 @@ ipv6_template_re = re.compile(r'^(%\([abcd]\)[dxX]|[A-Za-z0-9:-])+$')
class MACAddressFormField(forms.Field): class MACAddressFormField(forms.Field):
default_error_messages = { default_error_messages = {
'invalid': _(u'Enter a valid MAC address.'), 'invalid': _(u'Enter a valid MAC address. %s'),
} }
def validate(self, value): def validate(self, value):
try: try:
return EUI.from_str(value) return MACAddressField.from_str(value)
except (AddrFormatError, TypeError), e: except (AddrFormatError, TypeError), e:
raise ValidationError(self.default_error_messages['invalid'] raise ValidationError(self.default_error_messages['invalid']
% unicode(e)) % unicode(e))
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 sign in to comment