[IMP] dbfilter_from_header: black, isort
Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>pull/2425/head
parent
9c725ac160
commit
723ff14c39
|
@ -1,2 +1 @@
|
|||
|
||||
from . import override
|
||||
|
|
|
@ -6,16 +6,13 @@
|
|||
{
|
||||
"name": "dbfilter_from_header",
|
||||
"summary": "Filter databases with HTTP headers",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"website": "https://github.com/OCA/server-tools",
|
||||
"author": "Therp BV, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"author": "Therp BV, " "Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"complexity": "normal",
|
||||
"category": "Tools",
|
||||
"depends": [
|
||||
'web',
|
||||
],
|
||||
"depends": ["web"],
|
||||
"auto_install": False,
|
||||
'installable': True,
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from odoo import http
|
||||
from odoo.tools import config
|
||||
|
||||
|
@ -14,14 +15,15 @@ db_filter_org = http.db_filter
|
|||
def db_filter(dbs, httprequest=None):
|
||||
dbs = db_filter_org(dbs, httprequest)
|
||||
httprequest = httprequest or http.request.httprequest
|
||||
db_filter_hdr = httprequest.environ.get('HTTP_X_ODOO_DBFILTER')
|
||||
db_filter_hdr = httprequest.environ.get("HTTP_X_ODOO_DBFILTER")
|
||||
if db_filter_hdr:
|
||||
dbs = [db for db in dbs if re.match(db_filter_hdr, db)]
|
||||
return dbs
|
||||
|
||||
|
||||
if config.get('proxy_mode') and \
|
||||
'dbfilter_from_header' in config.get('server_wide_modules'):
|
||||
if config.get("proxy_mode") and "dbfilter_from_header" in config.get(
|
||||
"server_wide_modules"
|
||||
):
|
||||
_logger = logging.getLogger(__name__)
|
||||
_logger.info('monkey patching http.db_filter')
|
||||
_logger.info("monkey patching http.db_filter")
|
||||
http.db_filter = db_filter
|
||||
|
|
Loading…
Reference in New Issue