From 128ac38041f066b6220374e39fb70b7ed1e60f8e Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Sat, 16 Apr 2022 15:24:56 +0200 Subject: [PATCH] [IMP]DBFilter from config : allow empty then creation Without reboot requirement (because of cache). --- dbfilter_from_config/__manifest__.py | 2 +- dbfilter_from_config/override.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dbfilter_from_config/__manifest__.py b/dbfilter_from_config/__manifest__.py index 62cf653..98bdae8 100644 --- a/dbfilter_from_config/__manifest__.py +++ b/dbfilter_from_config/__manifest__.py @@ -27,7 +27,7 @@ Also required : `proxy_mode` to `True` Inspired from OCA `dbfilter_from_header`.""", - 'version': '15.0.0.0.1', + 'version': '15.0.0.0.2', 'category': 'Yaltik', 'author': 'Fabien Bourgeois', 'license': 'AGPL-3', diff --git a/dbfilter_from_config/override.py b/dbfilter_from_config/override.py index 4b4b432..5f746a4 100644 --- a/dbfilter_from_config/override.py +++ b/dbfilter_from_config/override.py @@ -38,10 +38,12 @@ http_host_resolv = {} def db_filter(dbs, httprequest=None): """ Override db_filter """ + print(http_host_resolv) if db_filter_str: httprequest = httprequest or http.request.httprequest http_host = httprequest.environ.get('HTTP_HOST', '').split(':')[0] - if http_host in http_host_resolv: + # If in cache and not empty + if http_host in http_host_resolv and http_host_resolv.get(http_host): dbs = http_host_resolv[http_host] elif http_host in all_hosts: for database, hosts in db_filter_dict.items():