From 22e25ac454b52686685d4d9f1241416cd35fafda Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Mon, 5 Dec 2022 22:44:50 +0100 Subject: Add django-upgrade to pre-commit (#114) --- users/shortcuts.py | 4 ++-- users/views/activitypub.py | 2 +- users/views/identity.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'users') diff --git a/users/shortcuts.py b/users/shortcuts.py index 0726218..8377a7f 100644 --- a/users/shortcuts.py +++ b/users/shortcuts.py @@ -9,10 +9,10 @@ def by_handle_or_404(request, handle, local=True, fetch=False) -> Identity: Domain-sensitive, so it will understand short handles on alternate domains. """ if "@" not in handle: - if "HTTP_HOST" not in request.META: + if "host" not in request.headers: raise Http404("No hostname available") username = handle - domain_instance = Domain.get_domain(request.META["HTTP_HOST"]) + domain_instance = Domain.get_domain(request.headers["host"]) if domain_instance is None: raise Http404("No matching domains found") domain = domain_instance.domain diff --git a/users/views/activitypub.py b/users/views/activitypub.py index c3395a4..b155b08 100644 --- a/users/views/activitypub.py +++ b/users/views/activitypub.py @@ -38,7 +38,7 @@ class HostMeta(View): """ - % request.META["HTTP_HOST"], + % request.headers["host"], content_type="application/xml", ) diff --git a/users/views/identity.py b/users/views/identity.py index d98ce9d..27d2e4e 100644 --- a/users/views/identity.py +++ b/users/views/identity.py @@ -42,7 +42,7 @@ class ViewIdentity(ListView): ): self.identity.transition_perform(IdentityStates.outdated) # If they're coming in looking for JSON, they want the actor - accept = request.META.get("HTTP_ACCEPT", "text/html").lower() + accept = request.headers.get("accept", "text/html").lower() if ( "application/json" in accept or "application/ld" in accept -- cgit v1.2.3