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
This commit is contained in:
parent
7286f4e424
commit
fd0c52550a
|
@ -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)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<field name="interval_number">6</field>
|
||||
<field name="interval_type">hours</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall">0</field>
|
||||
<field name="doall" eval="False" />
|
||||
<field eval="'base.gengo.translations'" name="model"></field>
|
||||
<field eval="'_sync_response'" name="function"/>
|
||||
<field eval="'(20,)'" name="args"/>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<field name="interval_number">6</field>
|
||||
<field name="interval_type">hours</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall">0</field>
|
||||
<field name="doall" eval="False"/>
|
||||
<field eval="'base.gengo.translations'" name="model"></field>
|
||||
<field eval="'_sync_request'" name="function"/>
|
||||
<field eval="'(20,)'" name="args"/>
|
||||
|
|
|
@ -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'));
|
||||
|
|
Loading…
Reference in New Issue