Merge lp:~unifield-team/unifield-server/us-1664 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4055
Proposed branch: lp:~unifield-team/unifield-server/us-1664
Merge into: lp:unifield-server
Diff against target: 93 lines (+50/-4)
3 files modified
bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py (+26/-4)
bin/addons/msf_profile/i18n/fr_MF.po (+17/-0)
bin/tools/import_po.dtd (+7/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1664
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+310551@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py'
--- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-08-23 12:54:03 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-11-10 16:13:50 +0000
@@ -25,14 +25,19 @@
25import base6425import base64
26import time26import time
27import xml.etree.ElementTree as ET27import xml.etree.ElementTree as ET
28from lxml import etree
29from lxml.etree import XMLSyntaxError
28import logging30import logging
31import os
2932
30from mx import DateTime33from mx import DateTime
3134
35
32# Server imports36# Server imports
33from osv import osv37from osv import osv
34from osv import fields38from osv import fields
35from tools.translate import _39from tools.translate import _
40import tools
3641
37# Addons imports42# Addons imports
38from msf_order_date import TRANSPORT_TYPE43from msf_order_date import TRANSPORT_TYPE
@@ -343,10 +348,27 @@
343 if not excel_file.getWorksheets():348 if not excel_file.getWorksheets():
344 raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !'))349 raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !'))
345 else:350 else:
346 xml_file = base64.decodestring(wiz.file_to_import)351 try:
347 root = ET.fromstring(xml_file)352 xml_file = base64.decodestring(wiz.file_to_import)
348 if root.tag != 'data':353 dtd_path = os.path.join(tools.config['root_path'], 'tools/import_po.dtd')
349 raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !'))354 dtd = etree.DTD(dtd_path)
355 tree = etree.fromstring(xml_file)
356 except XMLSyntaxError as ex:
357 raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !\nTechnical details:\n%s') % str(ex))
358
359 if not dtd.validate(tree):
360 # build error message:
361 error_msg = ""
362 for line_obj in dtd.error_log.filter_from_errors():
363 line = str(line_obj)
364 err_line = line.split(':')[1]
365 err_str = line.split(':')[-1]
366 err_type = line.split(':')[5]
367 if err_type != 'DTD_UNKNOWN_ELEM':
368 continue
369 error_msg += "Line %s: The tag '%s' is not supported\n" % (err_line, err_str.split()[-1])
370
371 raise osv.except_osv(_('Error'), _("The given XML file is not structured as expected in the DTD:\n %s") % error_msg)
350372
351 self.write(cr, uid, ids, {'state': 'simu_progress'}, context=context)373 self.write(cr, uid, ids, {'state': 'simu_progress'}, context=context)
352 cr.commit()374 cr.commit()
353375
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2016-10-25 09:13:52 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2016-11-10 16:13:50 +0000
@@ -74689,3 +74689,20 @@
74689msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."74689msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."
74690msgstr "Vous ne pouvez pas exécuter de recherche sur cet objet sans utiliser au moins une recherche exacte (ajoutez le caractère = devant votre filtre)."74690msgstr "Vous ne pouvez pas exécuter de recherche sur cet objet sans utiliser au moins une recherche exacte (ajoutez le caractère = devant votre filtre)."
7469174691
74692#. module: msf_doc_import
74693#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:357
74694#, python-format
74695msgid "The given file is not a valid XML file !\n"
74696"Technical details:\n"
74697"%s"
74698msgstr "Le fichier XML n'est pas valide.\n"
74699"Détails techniques:\n"
74700"%s"
74701
74702#. module: msf_doc_import
74703#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:371
74704#, python-format
74705msgid "The given XML file is not structured as expected in the DTD:\n"
74706" %s"
74707msgstr "La structure du fichier XML ne respecte pas la déclaration DTD:\n"
74708" %s"
74692\ No newline at end of file74709\ No newline at end of file
7469374710
=== added file 'bin/tools/import_po.dtd'
--- bin/tools/import_po.dtd 1970-01-01 00:00:00 +0000
+++ bin/tools/import_po.dtd 2016-11-10 16:13:50 +0000
@@ -0,0 +1,7 @@
1<!ELEMENT data (record+)>
2<!ELEMENT record (field+)>
3<!ELEMENT field ANY>
4<!ATTLIST record key CDATA #IMPLIED>
5<!ATTLIST record model CDATA #IMPLIED>
6<!ATTLIST field name CDATA #REQUIRED>
7<!ATTLIST field key CDATA #IMPLIED>

Subscribers

People subscribed via source and target branches

to all changes: