From b2ff7ef41d2fedb38496ad79edb04c3f2379a753 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Tue, 27 May 2014 15:51:09 +0200 Subject: [PATCH] [BACKPORT][FIX] base_gengo: use supported/up-to-date library Commit backported from master 8ad97da843bbd5c34f44dc4d5f7a4942179cf7b8 --- addons/base_gengo/doc/changelog.rst | 9 +++++++++ .../wizard/base_gengo_translations.py | 20 +++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 addons/base_gengo/doc/changelog.rst diff --git a/addons/base_gengo/doc/changelog.rst b/addons/base_gengo/doc/changelog.rst new file mode 100644 index 00000000000..be5c69cd946 --- /dev/null +++ b/addons/base_gengo/doc/changelog.rst @@ -0,0 +1,9 @@ +======================== +``base_gengo`` changelog +======================== + +******************************* +saas-4 (backported from saas-5) +******************************* + +- Library update: ``mygengo`` (https://pypi.python.org/pypi/mygengo/1.3.3) was outdated and has been replaced by ``gengo`` (https://pypi.python.org/pypi/gengo). diff --git a/addons/base_gengo/wizard/base_gengo_translations.py b/addons/base_gengo/wizard/base_gengo_translations.py index f565b520d6c..08dfb0182ae 100644 --- a/addons/base_gengo/wizard/base_gengo_translations.py +++ b/addons/base_gengo/wizard/base_gengo_translations.py @@ -30,9 +30,9 @@ from openerp.tools.translate import _ _logger = logging.getLogger(__name__) try: - from mygengo import MyGengo + from gengo import Gengo except ImportError: - _logger.warning('Gengo library not found, Gengo features disabled. If you plan to use it, please install the mygengo library from http://pypi.python.org/pypi/mygengo') + _logger.warning('Gengo library not found, Gengo features disabled. If you plan to use it, please install the gengo library from http://pypi.python.org/pypi/gengo') GENGO_DEFAULT_LIMIT = 20 @@ -50,21 +50,21 @@ class base_gengo_translations(osv.osv_memory): 'sync_limit' : 20 } def gengo_authentication(self, cr, uid, context=None): - ''' + ''' This method tries to open a connection with Gengo. For that, it uses the Public and Private keys that are linked to the company (given by Gengo on subscription). It returns a tuple with * as first element: a boolean depicting if the authentication was a success or not - * as second element: the connection, if it was a success, or the error message returned by + * as second element: the connection, if it was a success, or the error message returned by Gengo when the connection failed. - This error message can either be displayed in the server logs (if the authentication was called - by the cron) or in a dialog box (if requested by the user), thus it's important to return it + This error message can either be displayed in the server logs (if the authentication was called + by the cron) or in a dialog box (if requested by the user), thus it's important to return it translated. ''' user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key: return (False, _("Gengo `Public Key` or `Private Key` are missing. Enter your Gengo authentication parameters under `Settings > Companies > Gengo Parameters`.")) try: - gengo = MyGengo( + gengo = Gengo( public_key=user.company_id.gengo_public_key.encode('ascii'), private_key=user.company_id.gengo_private_key.encode('ascii'), sandbox=user.company_id.gengo_sandbox, @@ -208,10 +208,10 @@ class base_gengo_translations(osv.osv_memory): def _sync_request(self, cr, uid, limit=GENGO_DEFAULT_LIMIT, context=None): """ This scheduler will send a job request to the gengo , which terms are - waiing to be translated and for which gengo_translation is enabled. + waiing to be translated and for which gengo_translation is enabled. - A special key 'gengo_language' can be passed in the context in order to - request only translations of that language only. Its value is the language + A special key 'gengo_language' can be passed in the context in order to + request only translations of that language only. Its value is the language ID in openerp. """ if context is None: