[IMP]DBFilter from config : allow empty then creation

Without reboot requirement (because of cache).
This commit is contained in:
Fabien BOURGEOIS 2022-04-16 15:24:56 +02:00
parent 0d40afd498
commit 2e501018d8
2 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,7 @@
Also required : `proxy_mode` to `True`
Inspired from OCA `dbfilter_from_header`.""",
'version': '12.0.0.0.1',
'version': '12.0.0.0.2',
'category': 'Yaltik',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -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():