forked from ScoDoc/ScoDoc
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"
|
"Emulating Zope 2 REQUEST"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
if current_app.config["DEBUG"]:
|
||||||
self.URL = request.base_url
|
self.URL = request.base_url
|
||||||
|
|
||||||
self.URL0 = self.URL
|
|
||||||
self.BASE0 = request.url_root
|
self.BASE0 = request.url_root
|
||||||
self.QUERY_STRING = request.query_string.decode(
|
else:
|
||||||
"utf-8"
|
self.URL = request.base_url.replace("http://", "https://")
|
||||||
) # query_string is bytes
|
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.REQUEST_METHOD = request.method
|
||||||
self.AUTHENTICATED_USER = current_user
|
self.AUTHENTICATED_USER = current_user
|
||||||
self.REMOTE_ADDR = request.remote_addr
|
self.REMOTE_ADDR = request.remote_addr
|
||||||
|
@ -37,6 +37,7 @@ import flask
|
|||||||
from flask import url_for
|
from flask import url_for
|
||||||
from flask import g
|
from flask import g
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
from flask import request
|
||||||
|
|
||||||
from app.scodoc.notes_log import log, logCallStack
|
from app.scodoc.notes_log import log, logCallStack
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
@ -45,6 +45,7 @@ class ProdConfig(Config):
|
|||||||
SQLALCHEMY_DATABASE_URI = (
|
SQLALCHEMY_DATABASE_URI = (
|
||||||
os.environ.get("SCODOC_DATABASE_URI") or "postgresql:///SCODOC"
|
os.environ.get("SCODOC_DATABASE_URI") or "postgresql:///SCODOC"
|
||||||
)
|
)
|
||||||
|
PREFERRED_URL_SCHEME = "https"
|
||||||
|
|
||||||
|
|
||||||
class DevConfig(Config):
|
class DevConfig(Config):
|
||||||
@ -59,6 +60,7 @@ class DevConfig(Config):
|
|||||||
|
|
||||||
class TestConfig(DevConfig):
|
class TestConfig(DevConfig):
|
||||||
TESTING = True
|
TESTING = True
|
||||||
|
DEBUG = True
|
||||||
SQLALCHEMY_DATABASE_URI = (
|
SQLALCHEMY_DATABASE_URI = (
|
||||||
os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST"
|
os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user