diff --git a/webnotes/app.py b/webnotes/app.py index 74d627d900..98e02fd7a3 100644 --- a/webnotes/app.py +++ b/webnotes/app.py @@ -24,7 +24,8 @@ def application(request): webnotes.local.request = request try: - webnotes.init(site=request.host) + site = webnotes.utils.get_site_name(request.host) + webnotes.init(site=site) webnotes.local.form_dict = webnotes._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \ for k, v in (request.form or request.args).iteritems() }) diff --git a/webnotes/utils/__init__.py b/webnotes/utils/__init__.py index 2f5868ff57..30a09fe976 100644 --- a/webnotes/utils/__init__.py +++ b/webnotes/utils/__init__.py @@ -901,3 +901,6 @@ def compare(val1, condition, val2): return operator_map[condition]((val1, val2)) return False + +def get_site_name(hostname): + return hostname.split(':')[0]