Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch URL helper to assume use_appname=False if the host is a FQDN #918

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions py4web/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import zipfile
from collections import OrderedDict
from contextlib import redirect_stderr, redirect_stdout
from fqdn import FQDN

import portalocker
from watchgod import awatch
Expand Down Expand Up @@ -860,6 +861,8 @@ def URL( # pylint: disable=invalid-name
URL('a','b',vars=dict(x=1),scheme='https') -> https://{domain}/{script_name?}/{app_name?}/a/b?x=1
URL('a','b',vars=dict(x=1),use_appname=False) -> /{script_name?}/a/b?x=1
"""
if FQDN(request.urlparts[1]).is_valid:
use_appname = False
if use_appname is None:
# force use_appname on domain-unmapped apps
use_appname = not request.environ.get("HTTP_X_PY4WEB_APPNAME")
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rocket3 >= 20230507.1
yatl >= 20230507.3
pydal >= 20240713.1
watchgod >= 0.6
fqdn

# optional modules:
# gunicorn
Expand Down