This commit is contained in:
zandercymatics 2024-03-14 11:36:29 -06:00
parent fce679f417
commit 830cf667e7
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 12 additions and 0 deletions

View file

@ -325,6 +325,7 @@ class Domain(TimeStampedModel, DomainHelper):
Subordinate hosts (something.your-domain.gov) MUST have IP addresses, Subordinate hosts (something.your-domain.gov) MUST have IP addresses,
while non-subordinate hosts MUST NOT. while non-subordinate hosts MUST NOT.
""" """
raise ValueError("test")
try: try:
# attempt to retrieve hosts from registry and store in cache and db # attempt to retrieve hosts from registry and store in cache and db
hosts = self._get_property("hosts") hosts = self._get_property("hosts")

View file

@ -2,6 +2,7 @@
import abc # abstract base class import abc # abstract base class
from django.conf import settings
from django.views.generic import DetailView, DeleteView, TemplateView from django.views.generic import DetailView, DeleteView, TemplateView
from registrar.models import Domain, DomainRequest, DomainInvitation from registrar.models import Domain, DomainRequest, DomainInvitation
from registrar.models.user_domain_role import UserDomainRole from registrar.models.user_domain_role import UserDomainRole
@ -31,6 +32,16 @@ class DomainPermissionView(DomainPermission, DetailView, abc.ABC):
# variable name in template context for the model object # variable name in template context for the model object
context_object_name = "domain" context_object_name = "domain"
def dispatch(self, request, *args, **kwargs):
"""
Custom implementation of dispatch to ensure that 500 error pages (and others)
have access to the IS_PRODUCTION flag
"""
if "IS_PRODUCTION" not in request.session:
# Pass the production flag to the context
request.session["IS_PRODUCTION"] = settings.IS_PRODUCTION
return super().dispatch(request, *args, **kwargs)
# Adds context information for user permissions # Adds context information for user permissions
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)