mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 19:48:36 +02:00
minimal getter building form for dsdata
This commit is contained in:
parent
ef2b8494cb
commit
12ae675772
2 changed files with 21 additions and 13 deletions
|
@ -282,7 +282,13 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
|
||||
@Cache
|
||||
def dnssecdata(self) -> extensions.DNSSECExtension:
|
||||
return self._get_property("dnssecdata")
|
||||
try:
|
||||
return self._get_property("dnssecdata")
|
||||
except Exception as err:
|
||||
# Don't throw error as this is normal for a new domain
|
||||
# TODO - 433 error handling ticket should address this
|
||||
logger.info("Domain does not have dnssec data defined %s" % err)
|
||||
return None
|
||||
|
||||
@dnssecdata.setter # type: ignore
|
||||
def dnssecdata(self, _dnssecdata: extensions.DNSSECExtension):
|
||||
|
|
|
@ -235,7 +235,7 @@ class DomainDNSSECView(DomainPermissionView):
|
|||
template_name = "domain_dnssec.html"
|
||||
|
||||
|
||||
class DomainDsdataView(DomainPermissionView):
|
||||
class DomainDsdataView(DomainPermissionView, FormMixin):
|
||||
|
||||
"""Domain DNSSEC ds data editing view."""
|
||||
|
||||
|
@ -248,18 +248,20 @@ class DomainDsdataView(DomainPermissionView):
|
|||
dnssecdata: extensions.DNSSECExtension = domain.dnssecdata
|
||||
initial_data = []
|
||||
|
||||
if dnssecdata.keyData is not None:
|
||||
# TODO: Throw an error
|
||||
pass
|
||||
if dnssecdata is not None:
|
||||
|
||||
if dnssecdata.dsData is not None:
|
||||
# Add existing nameservers as initial data
|
||||
# TODO: create context for each element in the record
|
||||
# key_tag
|
||||
# algorithm
|
||||
# digest_type
|
||||
# digest
|
||||
initial_data.extend({"dsrecord": record} for record in dnssecdata.dsData)
|
||||
if dnssecdata.keyData is not None:
|
||||
# TODO: Throw an error
|
||||
pass
|
||||
|
||||
if dnssecdata.dsData is not None:
|
||||
# Add existing nameservers as initial data
|
||||
# TODO: create context for each element in the record
|
||||
# key_tag
|
||||
# algorithm
|
||||
# digest_type
|
||||
# digest
|
||||
initial_data.extend({"key_tag": record.keyTag, "algorithm": record.alg, "digest_type": record.digestType, "digest": record.digest} for record in dnssecdata.dsData)
|
||||
|
||||
return initial_data
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue