From 1e22f94905c7dd330713c8a40b5a2cc3e32c22f8 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 25 Sep 2013 18:53:31 +0530 Subject: [PATCH] get_site_name without the port --- webnotes/app.py | 3 ++- webnotes/utils/__init__.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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]