From fd0c52550af8b84301fcf10717a37115714880e6 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 16 Jul 2014 14:59:22 +0200 Subject: [PATCH] base_gengo: [FIX] change http status code for gengo_callback because status 100 make response very slow [FIX] Cron for gengo was always in mode 'do missed' what we don't want, replace 0 by False [FIX] Remove unused regexp to find view_id from js which was breaking the count words --- addons/base_gengo/controller/gengo_callback.py | 9 +++++---- addons/base_gengo/gengo_sync_schedular_data.xml | 4 ++-- addons/website_gengo/static/src/js/website_gengo.js | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/base_gengo/controller/gengo_callback.py b/addons/base_gengo/controller/gengo_callback.py index 44fa9b9390a..328be0ae357 100644 --- a/addons/base_gengo/controller/gengo_callback.py +++ b/addons/base_gengo/controller/gengo_callback.py @@ -18,17 +18,18 @@ class website_gengo(http.Controller): @http.route('/website/gengo_callback', type='http', auth='none') def gengo_callback(self, **post): + print "IN website/gengo_callback" cr, uid, context = request.cr, openerp.SUPERUSER_ID, request.context translation_pool = request.registry['ir.translation'] if post and post.get('job') and post.get('pgk'): if post.get('pgk') != self.get_gengo_key(cr): - return Response("Bad authentication - 403/412", status=412) + return Response("Bad authentication", status=104) job = json.loads(post['job'], 'utf-8') tid = job.get('custom_data', False) if (job.get('status') == 'approved') and tid: term = translation_pool.browse(cr, uid, int(tid), context=context) if term.src != job.get('body_src'): - return Response("Text Altered - Not saved", status=100) + return Response("Text Altered - Not saved", status=418) domain = [ '|', ('id', "=", int(tid)), @@ -49,5 +50,5 @@ class website_gengo(http.Controller): translation_pool.write(cr, uid, all_ir_tanslations, vals, context=context) return Response("OK", status=200) else: - return Response("No terms found", status=104) - return Response("Not saved", status=100) + return Response("No terms found", status=412) + return Response("Not saved", status=418) diff --git a/addons/base_gengo/gengo_sync_schedular_data.xml b/addons/base_gengo/gengo_sync_schedular_data.xml index e916489e5f7..0af74d8ccf1 100644 --- a/addons/base_gengo/gengo_sync_schedular_data.xml +++ b/addons/base_gengo/gengo_sync_schedular_data.xml @@ -8,7 +8,7 @@ 6 hours -1 - 0 + @@ -21,7 +21,7 @@ 6 hours -1 - 0 + diff --git a/addons/website_gengo/static/src/js/website_gengo.js b/addons/website_gengo/static/src/js/website_gengo.js index 4b7d9c34b4f..60aecb3ff45 100644 --- a/addons/website_gengo/static/src/js/website_gengo.js +++ b/addons/website_gengo/static/src/js/website_gengo.js @@ -89,7 +89,6 @@ }, translation_gengo_info: function () { var repr = $(document.documentElement).data('mainObject'); - var view_id = repr.match(/.+\((.+), (\d+)\)/)[2]; var translated_ids = []; $('.oe_translatable_text').not(".oe_translatable_inprogress").each(function(){ translated_ids.push($(this).attr('data-oe-translation-id'));