Reviewers: ,


Please review this at http://codereview.tryton.org/25003/

Affected files:
  M trytond/ir/translation.py


Index: trytond/ir/translation.py
===================================================================

--- a/trytond/ir/translation.py
+++ b/trytond/ir/translation.py
@@ -713,6 +713,7 @@
                 strings += self._translate_report(document.documentElement)

             for string in {}.fromkeys(strings).keys():
+                src_md5 = md5(string.encode('utf8')).hexdigest()
                 done = False
                 if string in trans_reports:
                     del trans_reports[string]
@@ -727,24 +728,23 @@
                         done = True
                         break
                     if seqmatch.ratio() > 0.6:
-                        cursor.execute('UPDATE ir_translation ' \
-                                'SET src = %s, ' \
-                                    'fuzzy = %s ' \
-                                'WHERE name = %s ' \
-                                    'AND type = %s ' \
-                                    'AND src = %s ' \
+                        cursor.execute('UPDATE ir_translation '
+                                'SET src = %s, fuzzy = %s, src_md5 = %s '
+                                'WHERE name = %s '
+                                    'AND type = %s '
+                                    'AND src = %s '
                                     'AND module = %s',
-                                (string, True, report.report_name, 'odt',
-                                    string_trans, report.module))
+                                (string, True, src_md5, report.report_name,
+                                    'odt', string_trans, report.module))
                         del trans_reports[string_trans]
                         done = True
                         break
                 if not done:
-                    cursor.execute('INSERT INTO ir_translation ' \
- '(name, lang, type, src, value, module, fuzzy)' \
-                            'VALUES (%s, %s, %s, %s, %s, %s, %s)',
- (report.report_name, 'en_US', 'odt', string, '',
-                                report.module, False))
+                    cursor.execute('INSERT INTO ir_translation '
+                        '(name, lang, type, src, value, module, fuzzy, '
+                        'src_md5) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
+                        (report.report_name, 'en_US', 'odt', string, '',
+                            report.module, False, src_md5))
             if strings:
                 cursor.execute('DELETE FROM ir_translation ' \
                         'WHERE name = %s ' \



--
[email protected] mailing list

Reply via email to