Skip to content

Commit

Permalink
Disable is_secure URL builder checks when DEBUG is on
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromsl committed May 18, 2023
1 parent c4a0ada commit 758310d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/core/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ def get_by_domain(cls, domain):
def site_url(self, path=None):
return logic.build_url(
netloc=self.domain,
scheme=self.SCHEMES[self.is_secure],
scheme=self._get_scheme(),
path=path or "",
)
def _get_scheme(self):
scheme = self.SCHEMES[self.is_secure]
if settings.DEBUG is True:
scheme = self.SCHEMES[False]
return scheme


class PGCaseInsensitivedMixin():
Expand Down
2 changes: 1 addition & 1 deletion src/journal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def site_url(self, path=""):
path = path[len(site_path):]
return logic.build_url(
netloc=self.domain,
scheme=self.SCHEMES[self.is_secure],
scheme=self._get_scheme(),
port=None,
path=path,
)
Expand Down
2 changes: 1 addition & 1 deletion src/press/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def site_path_url(self, child_site, path=None):

return logic.build_url(
netloc=self.domain,
scheme=self.SCHEMES[self.is_secure],
scheme=self._get_scheme(),
port=port,
path=_path,
)
Expand Down
2 changes: 1 addition & 1 deletion src/repository/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def site_url(self, path=""):
if self.domain and not settings.URL_CONFIG == 'path':
return logic.build_url(
netloc=self.domain,
scheme=self.SCHEMES[self.is_secure],
scheme=self._get_scheme(),
port=None,
path=path,
)
Expand Down

0 comments on commit 758310d

Please sign in to comment.