[FIX] im_livechat : do not crash if not Referer url in the header of the request.
authorJérome Maes <jem@openerp.com>
Mon, 8 Dec 2014 16:45:16 +0000 (17:45 +0100)
committerJérome Maes <jem@openerp.com>
Mon, 8 Dec 2014 16:45:24 +0000 (17:45 +0100)
addons/im_livechat/im_livechat.py

index f2ad703..24430e1 100644 (file)
@@ -308,7 +308,7 @@ class LiveChatController(http.Controller):
             if country_ids:
                 country_id = country_ids[0]
         # extract url
-        url = request.httprequest.headers['Referer'] or request.httprequest.base_url
+        url = request.httprequest.headers.get('Referer', False) or request.httprequest.base_url
         # find the match rule for the given country and url
         rule = registry.get('im_livechat.channel.rule').match_rule(cr, uid, channel_id, url, country_id, context=context)
         if rule: