diff --git a/octodns/record.py b/octodns/record.py index 514c2e6..728c187 100644 --- a/octodns/record.py +++ b/octodns/record.py @@ -506,7 +506,10 @@ class MxValue(object): def _validate_value(cls, value): reasons = [] try: - int(value.get('preference', None) or value['priority']) + try: + int(value['preference']) + except KeyError: + int(value['priority']) except KeyError: reasons.append('missing preference') except ValueError: diff --git a/tests/test_octodns_record.py b/tests/test_octodns_record.py index ff57975..0ba54de 100644 --- a/tests/test_octodns_record.py +++ b/tests/test_octodns_record.py @@ -345,7 +345,7 @@ class TestRecord(TestCase): self.assertEquals(a_data, a.data) b_value = { - 'preference': 12, + 'preference': 0, 'exchange': 'smtp3.', } b_data = {'ttl': 30, 'value': b_value}