Corrige calcul URL "zope compatibles" en http/https en mode production
This commit is contained in:
parent
fc3e7ba079
commit
9fb8796e0d
@ -41,13 +41,15 @@ class ZRequest(object):
|
||||
"Emulating Zope 2 REQUEST"
|
||||
|
||||
def __init__(self):
|
||||
if current_app.config["DEBUG"]:
|
||||
self.URL = request.base_url
|
||||
|
||||
self.URL0 = self.URL
|
||||
self.BASE0 = request.url_root
|
||||
self.QUERY_STRING = request.query_string.decode(
|
||||
"utf-8"
|
||||
) # query_string is bytes
|
||||
else:
|
||||
self.URL = request.base_url.replace("http://", "https://")
|
||||
self.BASE0 = request.url_root.replace("http://", "https://")
|
||||
self.URL0 = self.URL
|
||||
# query_string is bytes:
|
||||
self.QUERY_STRING = request.query_string.decode("utf-8")
|
||||
self.REQUEST_METHOD = request.method
|
||||
self.AUTHENTICATED_USER = current_user
|
||||
self.REMOTE_ADDR = request.remote_addr
|
||||
|
@ -37,6 +37,7 @@ import flask
|
||||
from flask import url_for
|
||||
from flask import g
|
||||
from flask_login import current_user
|
||||
from flask import request
|
||||
|
||||
from app.scodoc.notes_log import log, logCallStack
|
||||
import app.scodoc.sco_utils as scu
|
||||
|
@ -45,6 +45,7 @@ class ProdConfig(Config):
|
||||
SQLALCHEMY_DATABASE_URI = (
|
||||
os.environ.get("SCODOC_DATABASE_URI") or "postgresql:///SCODOC"
|
||||
)
|
||||
PREFERRED_URL_SCHEME = "https"
|
||||
|
||||
|
||||
class DevConfig(Config):
|
||||
@ -59,6 +60,7 @@ class DevConfig(Config):
|
||||
|
||||
class TestConfig(DevConfig):
|
||||
TESTING = True
|
||||
DEBUG = True
|
||||
SQLALCHEMY_DATABASE_URI = (
|
||||
os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user