Removed deleted bug fix

This commit is contained in:
zandercymatics 2023-10-11 07:48:44 -06:00
parent 2129d2dd67
commit 76e3e2eaea
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 2 additions and 44 deletions

View file

@ -138,6 +138,8 @@ class MyUserAdmin(BaseUserAdmin):
"email",
"first_name",
"last_name",
# Group is a custom property defined within this file,
# rather than in a model like the other properties
"group",
"status",
)

View file

@ -1293,50 +1293,6 @@ class Domain(TimeStampedModel, DomainHelper):
except RegistryError as e:
logger.error(e)
except TransitionNotAllowed as err:
# Fixes a bug with _fetch_cache trying to create
# a deleted domain, as cache gets cleared on delete.
# Instead, serve what we have locally.
if self.state == self.State.DELETED:
logger.warning("Attempted to create a deleted domain")
data = self._cache
choices = PublicContact.ContactTypeChoices
contacts_dict = {
choices.ADMINISTRATIVE: None,
choices.SECURITY: None,
choices.TECHNICAL: None,
}
registrant_id = ...
existing_contacts = PublicContact.objects.filter(domain=self)
if existing_contacts.count() > 0:
for choice in contacts_dict:
contacts_dict[choice] = existing_contacts.get(
contact_type=choice
).registry_id
# Edge case for registrant
registrant = PublicContact.ContactTypeChoices.REGISTRANT
registrant_id = existing_contacts.get(
contact_type=registrant
).registry_id
cache = {
"auth_info": getattr(data, "auth_info", ...),
"contacts": getattr(data, "contacts", contacts_dict),
"cr_date": getattr(data, "cr_date", ...),
"ex_date": getattr(data, "ex_date", ...),
"hosts": getattr(data, "hosts", ...),
"name": getattr(data, "name", self.name),
"registrant": getattr(data, "name", registrant_id),
"statuses": getattr(data, "statuses", ...),
"tr_date": getattr(data, "tr_date", ...),
"up_date": getattr(data, "up_date", ...),
}
cleaned = {k: v for k, v in cache.items() if v is not ...}
self._cache = cleaned
else:
logger.error("Unknown TransitionNotAllowed exception")
raise err
def _get_or_create_public_contact(self, public_contact: PublicContact):
"""Tries to find a PublicContact object in our DB.