diff options
| author | Denis Ledoux <dle@odoo.com> | 2016-09-06 12:01:50 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2016-09-06 12:04:43 +0200 |
| commit | f19d179bb0311df7d79cdef7f2726e0ccb6b9e27 (patch) | |
| tree | acbc09172c3c6e7c7bfe69bd06ece17c5261ac49 /addons/link_tracker/controller/main.py | |
| parent | 7970cbe178460eab52ddb4f51b2c69e4bdf0affa (diff) | |
[FIX] link_tracker: fix link tracer when no geoip in session
The `geoip` is not always defined in the session,
and therefore one needs to check it's defined before
attempting to use it.
The same is done at different places in the code,
through the different modules.
opw-687783
Diffstat (limited to 'addons/link_tracker/controller/main.py')
| -rw-r--r-- | addons/link_tracker/controller/main.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/link_tracker/controller/main.py b/addons/link_tracker/controller/main.py index 1d7707fb65a..1f6caf4f7f4 100644 --- a/addons/link_tracker/controller/main.py +++ b/addons/link_tracker/controller/main.py @@ -8,6 +8,7 @@ from openerp.http import request class link_tracker(http.Controller): @http.route('/r/<string:code>', type='http', auth='none', website=True) def full_url_redirect(self, code, **post): - request.env['link.tracker.click'].add_click(code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=False) + country_code = request.session.geoip and request.session.geoip.get('country_code') or False + request.env['link.tracker.click'].add_click(code, request.httprequest.remote_addr, country_code, stat_id=False) redirect_url = request.env['link.tracker'].get_url_from_code(code) return werkzeug.utils.redirect(redirect_url or '', 301) |
