diff options
| author | Gaurav Panchal <gan@openerp.com> | 2015-06-30 13:21:41 +0530 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-07-31 12:57:24 +0200 |
| commit | d52ec7fc42cbeecafea921ea30d1d0723a59078a (patch) | |
| tree | 43695e3eeb88ceca1947836b0f2820ae2892744e /addons/website/controllers/main.py | |
| parent | 9fa38eeab2382144ad37cfb4755ead114dd48dc3 (diff) | |
[IMP] website: keyword search base on language on website promote
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 32c006d1a6a..7aeec890d1b 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -257,12 +257,13 @@ class Website(openerp.addons.web.controllers.main.Home): obj = _object.browse(request.cr, request.uid, _id) return bool(obj.website_published) - @http.route(['/website/seo_suggest/<keywords>'], type='http', auth="public", website=True) - def seo_suggest(self, keywords): + @http.route(['/website/seo_suggest'], type='json', auth="user", website=True) + def seo_suggest(self, keywords=None, lang=None): + language = lang.split("_") url = "http://google.com/complete/search" try: req = urllib2.Request("%s?%s" % (url, werkzeug.url_encode({ - 'ie': 'utf8', 'oe': 'utf8', 'output': 'toolbar', 'q': keywords}))) + 'ie': 'utf8', 'oe': 'utf8', 'output': 'toolbar', 'q': keywords, 'hl': language[0], 'gl': language[1]}))) request = urllib2.urlopen(req) except (urllib2.HTTPError, urllib2.URLError): return [] |
