Skip to content

Commit

Permalink
handle resolver without current authority; tests
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Jan 20, 2024
1 parent 0347667 commit d6b5960
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions peachjam/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class RedirectResolver:
}

def __init__(self, app_name):
self.current_authority = self.RESOLVER_MAPPINGS[app_name.lower()]
self.current_authority = self.RESOLVER_MAPPINGS.get(app_name.lower())

def get_domain_for_frbr_uri(self, parsed_frbr_uri):
best_domain = self.get_best_domain(parsed_frbr_uri)
if best_domain != self.current_authority["domain"]:
if self.current_authority and best_domain != self.current_authority["domain"]:
return best_domain
return None

Expand Down
2 changes: 1 addition & 1 deletion peachjam/tests/test_resolver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cobalt import FrbrUri
from django.test import TestCase

from peachjam.views.documents import RedirectResolver
from peachjam.resolver import RedirectResolver

urls = [
"/akn/zm/judgment/zmsc/2021/7/eng@2021-01-19",
Expand Down

0 comments on commit d6b5960

Please sign in to comment.