Skip to content

Commit

Permalink
[FIX] make dbfilter_from_header compliant with its documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Nov 18, 2015
1 parent 35f26dc commit 5737ebc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions dbfilter_from_header/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
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') or \
httprequest.environ.get('HTTP_X_OPENERP_DBFILTER')
db_filter_hdr_odoo = httprequest.environ.get('HTTP_X_ODOO_DBFILTER')
db_filter_hdr_openerp = httprequest.environ.get('HTTP_X_OPENERP_DBFILTER')
if db_filter_hdr_odoo and db_filter_hdr_openerp:
raise RuntimeError("x-odoo-dbfilter and x-openerp-dbfiter "
"are both set")
db_filter_hdr = db_filter_hdr_odoo or db_filter_hdr_openerp
if db_filter_hdr:
dbs = [db for db in dbs if re.match(db_filter_hdr, db)]
return dbs
Expand Down
5 changes: 3 additions & 2 deletions dbfilter_from_header/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
"name": "dbfilter_from_header",
"version": "8.0.1.0.0",
"version": "8.0.1.0.1",
"author": "Therp BV,Odoo Community Association (OCA)",
"license": "AGPL-3",
"complexity": "normal",
Expand All @@ -30,8 +30,9 @@
This is interesting for setups where database names can't be mapped to
proxied host names.
In nginx, use
In nginx, use one of
proxy_set_header X-OpenERP-dbfilter [your filter];
proxy_set_header X-Odoo-dbfilter [your filter];
The addon has to be loaded as server-wide module.
""",
Expand Down

0 comments on commit 5737ebc

Please sign in to comment.