From 0114e54bd3720d8600d5e4a21522f287960c3442 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 6 Dec 2018 06:14:04 -0800 Subject: [PATCH] Remove _DynamicRuleGeo, its overkill, no details parsing for now --- octodns/record.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/octodns/record.py b/octodns/record.py index 60a3686..61edc24 100644 --- a/octodns/record.py +++ b/octodns/record.py @@ -390,7 +390,6 @@ class _DynamicPool(object): def __init__(self, _id, data): self._id = _id - # TODO: actually parse this self.data = data def _data(self): @@ -406,27 +405,10 @@ class _DynamicPool(object): return '{}'.format(self.data) -class _DynamicRuleGeo(object): - geo_re = re.compile(r'^(?P\w\w)(-(?P\w\w)' - r'(-(?P\w\w))?)?$') - - @classmethod - def validate(cls, rule_num, code): - reasons = [] - # TODO: ideally this would validate the actual code... - match = cls.geo_re.match(code) - if not match: - reasons.append('rule {} invalid geo "{}"'.format(rule_num, code)) - return reasons - - # TODO: flesh this out - - class _DynamicRule(object): def __init__(self, i, data): self.i = i - # TODO: actually parse this self.data = data def _data(self): @@ -472,6 +454,8 @@ class _Dynamic(object): class _DynamicMixin(object): + geo_re = re.compile(r'^(?P\w\w)(-(?P\w\w)' + r'(-(?P\w\w))?)?$') @classmethod def validate(cls, name, data): @@ -564,7 +548,11 @@ class _DynamicMixin(object): .format(rule_num)) else: for geo in geos: - reasons.extend(_DynamicRuleGeo.validate(rule_num, geo)) + # TODO: ideally this would validate the actual code... + match = cls.geo_re.match(geo) + if not match: + reasons.append('rule {} invalid geo "{}"' + .format(rule_num, geo)) return reasons