Change Can't to Can’t in a bunch of error messages

This commit is contained in:
Rachid Mrad 2025-02-13 13:34:31 -05:00
parent 153e9ffa1a
commit 7dc1cb073d
No known key found for this signature in database
10 changed files with 28 additions and 24 deletions

View file

@ -780,7 +780,7 @@ class Domain(TimeStampedModel, DomainHelper):
try:
return self._get_property("statuses")
except KeyError:
logger.error("Can't retrieve status from domain info")
logger.error("Cant retrieve status from domain info")
return []
@statuses.setter # type: ignore
@ -857,7 +857,7 @@ class Domain(TimeStampedModel, DomainHelper):
if rem:
action = "remove"
raise Exception("Can't %s the contact of type %s" % (action, contact.contact_type))
raise Exception("Cant %s the contact of type %s" % (action, contact.contact_type))
@Cache
def security_contact(self) -> PublicContact | None:
@ -2087,7 +2087,7 @@ class Domain(TimeStampedModel, DomainHelper):
def _get_or_create_public_contact(self, public_contact: PublicContact):
"""Tries to find a PublicContact object in our DB.
If it can't, it'll create it. Returns PublicContact"""
If it cant, it'll create it. Returns PublicContact"""
db_contact = PublicContact.objects.filter(
registry_id=public_contact.registry_id,
contact_type=public_contact.contact_type,

View file

@ -862,7 +862,7 @@ class DomainRequest(TimeStampedModel):
self.approved_domain = None
except Exception as err:
logger.error(err)
logger.error(f"Can't query an approved domain while attempting {called_from}")
logger.error(f"Cant query an approved domain while attempting {called_from}")
# Delete the suborg as long as this is the only place it is used
self._cleanup_dangling_suborg()

View file

@ -5,7 +5,7 @@
System outage
</h3>
<p class="usa-alert__text maxw-none">
Oct 16, 24:00 UTC: We're investigating an outage on the .gov registrar. The .gov zone and individual domains remain online. However, you can't request a new domain or manage an existing one at this time.
Oct 16, 24:00 UTC: We're investigating an outage on the .gov registrar. The .gov zone and individual domains remain online. However, you cant request a new domain or manage an existing one at this time.
</p>
</div>
</div>

View file

@ -526,7 +526,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -595,7 +595,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -661,7 +661,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -943,7 +943,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -1010,7 +1010,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -1076,7 +1076,7 @@ class TestDomainInvitationAdmin(WebTest):
# Assert error message
mock_messages_error.assert_called_once_with(
request, "Can't send invitation email. No email is associated with your user account."
request, "Cant send invitation email. No email is associated with your user account."
)
# Assert the invitations were saved
@ -1484,7 +1484,7 @@ class TestPortfolioInvitationAdmin(TestCase):
# Assert that messages.error was called with the correct message
mock_messages_error.assert_called_once_with(
request,
"Can't send invitation email. No email is associated with your user account.",
"Cant send invitation email. No email is associated with your user account.",
)
@less_console_noise_decorator

View file

@ -531,7 +531,7 @@ class PortfolioInvitationEmailTests(unittest.TestCase):
send_portfolio_invitation_email(self.email, self.requestor, self.portfolio, is_admin_invitation)
self.assertIn(
"Can't send invitation email. No email is associated with your user account.", str(context.exception)
"Cant send invitation email. No email is associated with your user account.", str(context.exception)
)
@less_console_noise_decorator
@ -869,7 +869,7 @@ class SendPortfolioAdminRemovalEmailsTests(unittest.TestCase):
mock_get_requestor_email.assert_called_once_with(self.requestor, portfolio=self.portfolio)
mock_send_removal_emails.assert_not_called() # Should not proceed if email retrieval fails
self.assertEqual(
str(context.exception), "Can't send invitation email. No email is associated with your user account."
str(context.exception), "Cant send invitation email. No email is associated with your user account."
)
@less_console_noise_decorator

View file

@ -20,7 +20,7 @@ class TestNameserverError(TestCase):
"""Test NameserverError when no ip address
and no nameserver is passed"""
nameserver = "nameserver val"
expected = "You can't have more than 13 nameservers."
expected = "You cant have more than 13 nameservers."
nsException = NameserverError(code=nsErrorCodes.TOO_MANY_HOSTS, nameserver=nameserver)
self.assertEqual(nsException.message, expected)

View file

@ -1331,7 +1331,7 @@ class TestDomainManagers(TestDomainOverview):
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
add_page.form.submit()
expected_message_content = "Can't send invitation email. No email is associated with your user account."
expected_message_content = "Cant send invitation email. No email is associated with your user account."
# Assert that the error message was called with the correct argument
mock_error.assert_called_once_with(

View file

@ -1696,12 +1696,16 @@ class TestPortfolioMemberDeleteView(WebTest):
self.assertEqual(response.status_code, 400) # Bad request due to active requests
support_url = "https://get.gov/contact/"
expected_error_message = (
"This member can't be removed from the organization because they have an active domain request. "
"This member can\u2019t be removed from the organization because they have an active domain request. "
f"Please <a class='usa-link' href='{support_url}' target='_blank'>contact us</a> "
"to remove this member."
)
self.assertContains(response, expected_error_message, status_code=400)
# The curly apostrophe \u2019 requires us to do a bit more work before we can assert
response_json = json.loads(response.content.decode("utf-8"))
self.assertEqual(response.status_code, 400) # Ensure it's a bad request
self.assertIn("error", response_json) # Ensure the "error" key exists
self.assertEqual(response_json["error"], expected_error_message) # Compare actual vs expected message
# assert that send_portfolio_admin_removal_emails is not called
send_removal_emails.assert_not_called()
@ -1956,7 +1960,7 @@ class TestPortfolioMemberDeleteView(WebTest):
support_url = "https://get.gov/contact/"
expected_error_message = (
"This member can't be removed from the organization because they have an active domain request. "
"This member cant be removed from the organization because they have an active domain request. "
f"Please <a class='usa-link' href='{support_url}' target='_blank'>contact us</a> "
"to remove this member."
)

View file

@ -48,13 +48,13 @@ class MissingEmailError(InvitationError):
def __init__(self, email=None, domain=None, portfolio=None):
# Default message if no additional info is provided
message = "Can't send invitation email. No email is associated with your user account."
message = "Cant send invitation email. No email is associated with your user account."
# Customize message based on provided arguments
if email and domain:
message = f"Can't send email to '{email}' on domain '{domain}'. No email exists for the requestor."
message = f"Cant send email to '{email}' on domain '{domain}'. No email exists for the requestor."
elif email and portfolio:
message = f"Can't send email to '{email}' for portfolio '{portfolio}'. No email exists for the requestor."
message = f"Cant send email to '{email}' for portfolio '{portfolio}'. No email exists for the requestor."
super().__init__(message)
@ -201,7 +201,7 @@ class NameserverError(Exception):
NameserverErrorCodes.MISSING_IP: ("Using your domain for a name server requires an IP address."),
NameserverErrorCodes.GLUE_RECORD_NOT_ALLOWED: ("Name server address does not match domain name"),
NameserverErrorCodes.INVALID_IP: ("{}: Enter an IP address in the required format."),
NameserverErrorCodes.TOO_MANY_HOSTS: ("You can't have more than 13 nameservers."),
NameserverErrorCodes.TOO_MANY_HOSTS: ("You cant have more than 13 nameservers."),
NameserverErrorCodes.MISSING_HOST: ("You must provide a name server to enter an IP address."),
NameserverErrorCodes.INVALID_HOST: ("Enter a name server in the required format, like ns1.example.com"),
NameserverErrorCodes.DUPLICATE_HOST: (

View file

@ -935,7 +935,7 @@ class PortfolioAddMemberView(PortfolioMembersPermissionView, FormMixin):
elif isinstance(exception, MissingEmailError):
messages.error(self.request, str(exception))
logger.error(
f"Can't send email to '{email}' for portfolio '{portfolio}'. No email exists for the requestor.",
f"Cant send email to '{email}' for portfolio '{portfolio}'. No email exists for the requestor.",
exc_info=True,
)
else: