[FIX] get_current_website domain check outside of cache
authorFabien Meghazi <fme@openerp.com>
Mon, 15 Sep 2014 08:04:17 +0000 (10:04 +0200)
committerFabien Meghazi <fme@openerp.com>
Tue, 16 Sep 2014 12:11:09 +0000 (14:11 +0200)
addons/website/models/website.py

index a5062b1..c801b66 100644 (file)
@@ -252,17 +252,17 @@ class website(osv.osv):
         return langs
 
     @openerp.tools.ormcache(skiparg=4)
-    def _get_current_website_id(self, cr, uid, context=None):
+    def _get_current_website_id(self, cr, uid, domain_name, context=None):
         website_id = 1
         if request:
-            domain_name = request.httprequest.environ.get('HTTP_HOST', '').split(':')[0]
             ids = self.search(cr, uid, [('name', '=', domain_name)], context=context)
             if ids:
                 website_id = ids[0]
         return website_id
 
     def get_current_website(self, cr, uid, context=None):
-        website_id = self._get_current_website_id(cr, uid, context=context)
+        domain_name = request.httprequest.environ.get('HTTP_HOST', '').split(':')[0]
+        website_id = self._get_current_website_id(cr, uid, domain_name, context=context)
         return self.browse(cr, uid, website_id, context=context)
 
     def is_publisher(self, cr, uid, ids, context=None):