[FIX]DBFilter From Config : do not cache outside of explicit dbfilter
This commit is contained in:
parent
401b3b5ffc
commit
8767b1aaeb
@ -27,7 +27,7 @@
|
|||||||
Also required : `proxy_mode` to `True`
|
Also required : `proxy_mode` to `True`
|
||||||
|
|
||||||
Inspired from OCA `dbfilter_from_header`.""",
|
Inspired from OCA `dbfilter_from_header`.""",
|
||||||
'version': '12.0.0.0.4',
|
'version': '12.0.0.0.5',
|
||||||
'category': 'Yaltik',
|
'category': 'Yaltik',
|
||||||
'author': 'Fabien Bourgeois',
|
'author': 'Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -38,9 +38,9 @@ http_host_resolv = {}
|
|||||||
|
|
||||||
def db_filter(dbs, httprequest=None):
|
def db_filter(dbs, httprequest=None):
|
||||||
""" Override db_filter """
|
""" Override db_filter """
|
||||||
http_host = httprequest.environ.get('HTTP_HOST', '').split(':')[0] if httprequest else ''
|
|
||||||
if db_filter_str:
|
if db_filter_str:
|
||||||
httprequest = httprequest or http.request.httprequest
|
httprequest = httprequest or http.request.httprequest
|
||||||
|
http_host = httprequest.environ.get('HTTP_HOST', '').split(':')[0]
|
||||||
# If in cache and not empty
|
# If in cache and not empty
|
||||||
if http_host in http_host_resolv and http_host_resolv.get(http_host):
|
if http_host in http_host_resolv and http_host_resolv.get(http_host):
|
||||||
dbs = http_host_resolv[http_host]
|
dbs = http_host_resolv[http_host]
|
||||||
@ -52,10 +52,10 @@ def db_filter(dbs, httprequest=None):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
dbs = db_filter_odoo(dbs, httprequest)
|
dbs = db_filter_odoo(dbs, httprequest)
|
||||||
|
if http_host not in http_host_resolv:
|
||||||
|
http_host_resolv[http_host] = dbs
|
||||||
else:
|
else:
|
||||||
dbs = db_filter_odoo(dbs, httprequest)
|
dbs = db_filter_odoo(dbs, httprequest)
|
||||||
if http_host not in http_host_resolv:
|
|
||||||
http_host_resolv[http_host] = dbs
|
|
||||||
return dbs
|
return dbs
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user