Skip to content

Commit

Permalink
fix(#2737): Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pbanaszkiewicz committed Feb 14, 2025
1 parent df08a96 commit 25181f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions amy/extrequests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError, transaction
from django.db.models import Prefetch, ProtectedError, Q
from django.http import HttpRequest
from django.http import HttpRequest, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from requests.exceptions import HTTPError, RequestException
Expand Down Expand Up @@ -721,7 +721,7 @@ def _match_training_request_to_person(


@admin_required
def trainingrequest_details(request, pk):
def trainingrequest_details(request: HttpRequest, pk: str) -> HttpResponse:
req = get_object_or_404(TrainingRequest, pk=int(pk))

if request.method == "POST":
Expand All @@ -734,7 +734,7 @@ def trainingrequest_details(request, pk):
if ok:
next_url = request.GET.get("next", None)
default_url = reverse("trainingrequest_details", args=[req.pk])
return safe_next_or_default_url(next_url, default_url)
return redirect(safe_next_or_default_url(next_url, default_url))

else: # GET request
# Provide initial value for form.person
Expand Down
6 changes: 5 additions & 1 deletion amy/workshops/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def find_workshop_HTML_metadata(content: str) -> dict[str, str]:
parser = HTMLMetaParser()
parser.feed(content)

return {name: content for name, content in parser.meta_tags.items() if name in ALLOWED_METADATA_NAMES and content}
return {
name: content
for name, content in parser.meta_tags.items()
if name in ALLOWED_METADATA_NAMES and content is not None
}


def parse_workshop_metadata(metadata: dict[str, str]) -> WorkshopMetadata:
Expand Down

0 comments on commit 25181f4

Please sign in to comment.