Merge pull request #358 from ajite/master-fix-nowww

[IMP] Db filter %h
This commit is contained in:
Christophe Simonis 2014-06-05 16:32:32 +02:00
commit bd51bf1e35
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