Manage non-ascii PG errors #167

Merged
merged 3 commits into from Jan 28, 2016

Conversation

Projects
None yet
3 participants
@npiganeau
Contributor

npiganeau commented Dec 28, 2015

When PG is localized, error messages are not ascii and jobs are not postponed. Instead they are failed with a 'unicode decode error'.

Note: even if PG lc_messages is set to en_us.utf8 on a localized system, the error message prefixes (such as DETAILS:) are still localized.

npiganeau added some commits Dec 28, 2015

Manage non-ascii PG errors
When PG is localized, error messages are not ascii and jobs are not postponed. Instead they are failed with a 'unicode decode error'.

Note: even if PG ```lc_messages``` is set to en_us.utf8 on a localized system, the error message prefixes (such as ```DETAILS:```) are still localized.
@guewen

This comment has been minimized.

Show comment
Hide comment
@guewen

guewen Jan 4, 2016

Member

👍

Member

guewen commented Jan 4, 2016

👍

connector/controllers/main.py
@@ -94,7 +94,8 @@ def retry_postpone(job, message, seconds=None):
if err.pgcode not in PG_CONCURRENCY_ERRORS_TO_RETRY:
raise
- retry_postpone(job, unicode(err), seconds=PG_RETRY)
+ retry_postpone(job, unicode(err.pgerror, errors='replace'),

This comment has been minimized.

@lmignon

lmignon Jan 4, 2016

Contributor

May be we can replace the call to unicode with

from openerp import tools
...
    retry_postpone(job, tools.ustr(err), seconds=PG_RETRY)
...

https://github.com/odoo/odoo/blob/8.0/openerp/loglevels.py#L58

@lmignon

lmignon Jan 4, 2016

Contributor

May be we can replace the call to unicode with

from openerp import tools
...
    retry_postpone(job, tools.ustr(err), seconds=PG_RETRY)
...

https://github.com/odoo/odoo/blob/8.0/openerp/loglevels.py#L58

@guewen

This comment has been minimized.

Show comment
Hide comment
@guewen

guewen Jan 4, 2016

Member

I agree with @lmignon suggestion, could you change that? (possibly by passing errors='ignore' to ustr too).

Member

guewen commented Jan 4, 2016

I agree with @lmignon suggestion, could you change that? (possibly by passing errors='ignore' to ustr too).

@guewen

This comment has been minimized.

Show comment
Hide comment
@guewen

guewen Jan 28, 2016

Member

thanks @npiganeau
@lmignon ok for you?

Member

guewen commented Jan 28, 2016

thanks @npiganeau
@lmignon ok for you?

@lmignon

This comment has been minimized.

Show comment
Hide comment
@lmignon

lmignon Jan 28, 2016

Contributor

👍 @guewen Ok for me!

Contributor

lmignon commented Jan 28, 2016

👍 @guewen Ok for me!

guewen added a commit that referenced this pull request Jan 28, 2016

Merge pull request #167 from npiganeau/patch-1
Manage non-ascii PG errors

@guewen guewen merged commit f8dad52 into OCA:8.0 Jan 28, 2016

2 checks passed

ci/runbot runbot build 3139159-167-6c32f9 (runtime 30s)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment