[IMP] Db filter %h

Db filter %h skips www subdomain.
This commit is contained in:
Augustin Cisterne-Kaas 2014-06-05 16:09:04 +02:00
parent b64256d56a
commit 1dfa3946b5
1 changed files with 3 additions and 1 deletions

View File

@ -1287,7 +1287,9 @@ def db_list(force=False, httprequest=None):
def db_filter(dbs, httprequest=None):
httprequest = httprequest or request.httprequest
h = httprequest.environ.get('HTTP_HOST', '').split(':')[0]
d = h.split('.')[0]
d, _, r = h.partition('.')
if d == "www" and r:
d = r.partition('.')[0]
r = openerp.tools.config['dbfilter'].replace('%h', h).replace('%d', d)
dbs = [i for i in dbs if re.match(r, i)]
return dbs