Skip to content

Commit

Permalink
Mypy checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Sep 18, 2024
1 parent 46cdff4 commit 4a25a32
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions openatlas/api/endpoints/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ def __init__(self, parser: dict[str, Any]):
setattr(self, item, parser[item])
if self.search:
self.set_search_param()
if self.url:
self.is_valid_url()
if not self.url.endswith('/'):
self.url += '/'
self.is_valid_url()
if self.url and not self.url.endswith('/'):
self.url += '/'

def set_search_param(self) -> None:
try:
Expand Down Expand Up @@ -288,7 +287,9 @@ def get_entities_template(self) -> dict[str, Any]:
return linked_place_pagination(self)

def is_valid_url(self) -> None:
if isinstance(validators.url(self.url), validators.ValidationFailure):
if self.url and isinstance(
validators.url(self.url),
validators.ValidationFailure):
raise UrlNotValid(self.url)

@staticmethod
Expand Down

0 comments on commit 4a25a32

Please sign in to comment.