From 4431c8c843f28f9229a5cacb8b786b2b8303fd6b Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 9 May 2018 11:40:56 +0200 Subject: [PATCH 1/2] [FIX] website: GeoIP Legacy compatibility Some IPs (like google-proxy ones) are not bound to a specific country. Legacy Database used to set country_code to 'EU' for these one. geoip2, on contrary, does not set the country. Read information from `continent` attribute in this case. opw-1844888 --- addons/website/geoipresolver.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website/geoipresolver.py b/addons/website/geoipresolver.py index 1f9b0e22724..e95b9318eb2 100644 --- a/addons/website/geoipresolver.py +++ b/addons/website/geoipresolver.py @@ -47,10 +47,14 @@ class GeoIPResolver(object): r = self._db.city(ip) except (ValueError, geoip2.errors.AddressNotFoundError): return {} + # Compatibility with Legacy database. + # Some ips cannot be located to a specific country. Legacy DB used to locate them in + # continent instead of country. Do the same to not change behavior of existing code. + country = r.country if r.country.geoname_id else r.continent return { 'city': r.city.name, - 'country_code': r.country.iso_code, - 'country_name': r.country.name, + 'country_code': country.iso_code, + 'country_name': country.name, 'region': r.subdivisions[0].iso_code if r.subdivisions else None, 'time_zone': r.location.time_zone, } From 1dae7ea1d660dca32e7261c5c0ed710e5541c641 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 22 May 2017 10:04:19 +0200 Subject: [PATCH 2/2] [FIX] web_editor: inline space in source code Backport of 57f7c681062f07002312e91d79d02b2b1b59d9fe --- addons/web_editor/static/src/js/rte.summernote.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index 25d966b354d..123b5560424 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -485,7 +485,12 @@ function prettify_html(html) { level--; } - result += token.trim().replace(/\s+/, ' '); + // don't trim inline content (which could change appearance) + if (!inline) { + token = token.trim(); + } + + result += token.replace(/\s+/, ' '); if (inline_level > level) { result += '\n';