From e556c785995e2de06a95b479a302b44bea0bdab9 Mon Sep 17 00:00:00 2001 From: dansheps Date: Fri, 5 Apr 2019 09:36:56 -0500 Subject: [PATCH] Fixes #3047: Fix exception string for invalid MAC Address format --- netbox/dcim/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/fields.py b/netbox/dcim/fields.py index 8d4bfba35..b91fd4244 100644 --- a/netbox/dcim/fields.py +++ b/netbox/dcim/fields.py @@ -2,6 +2,7 @@ from django.core.exceptions import ValidationError from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from netaddr import AddrFormatError, EUI, mac_unix_expanded +import pprint class ASNField(models.BigIntegerField): @@ -31,7 +32,7 @@ class MACAddressField(models.Field): try: return EUI(value, version=48, dialect=mac_unix_expanded_uppercase) except AddrFormatError as e: - raise ValidationError(e) + raise ValidationError("Invalid MAC address format: {}".format(value)) def db_type(self, connection): return 'macaddr'