andr1an/nic-api

Add support for not specifying TTL for records

Closed this issue · 1 comments

Script raises AttributeError when loading XML response into model:

  File "/usr/local/lib/python2.7/site-packages/nic_api/__init__.py", line 231, in records
    return [parse_record(rr) for rr in _zone.findall('rr')]
  File "/usr/local/lib/python2.7/site-packages/nic_api/models.py", line 41, in parse_record
    return record_classes[record_type].from_xml(rr)
  File "/usr/local/lib/python2.7/site-packages/nic_api/models.py", line 266, in from_xml
    ttl = rr.find('ttl').text
AttributeError: 'NoneType' object has no attribute 'text'

TTL field and <ttl> tag for records is optional, NIC.RU uses zone's default TTL for these records.

Finally fixed in 331cfd8.