Tryton - Issues

 

Issue6128

Title psycopg2cffi can't ascii encode character sql_contrain
Priority bug Status deferred
Superseder Nosy List ced, resteve, reviewbot, roundup-bot
Type crash Components trytond
Assigned To Keywords review
Reviews 31831002
View: 31831002

Created on 2016-12-20.10:22:40 by resteve, last changed by resteve.

Messages
msg31014 (view) Author: [hidden] (resteve) Date: 2016-12-28.10:46:23
I think both commits was released in 2.7.5 (31 October 2016) and doesn't fix.

I open new issue at chtd/psycopg2cffi:

https://github.com/chtd/psycopg2cffi/issues/75
msg31010 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-28.10:26:16
Or maybe it is https://github.com/chtd/psycopg2cffi/issues/56
msg31009 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-28.10:24:17
It seems it has been fixed by https://github.com/chtd/psycopg2cffi/pull/72
msg31000 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-28.00:09:56
No this is not a good solution for two reasons:
- the problem is in psycopg2cffi so it should be fixed there
- nothing said that psycopg2cffi does not have the bug with unicode method

So the bug must be reported upstream.
msg30998 (view) Author: [hidden] (resteve) Date: 2016-12-27.23:32:30
Other idea is convert exception (1) to unicode:

            except DatabaseIntegrityError, exception:
                exception = unicode(exception).encode('utf-8')
                transaction = Transaction()

(1) https://bitbucket.org/tryton/trytond/src/bcea32cb1aaef7c4b345e01a76b49d2c237bb7c1/trytond/model/modelsql.py?at=default&fileviewer=file-view-default#modelsql.py-557

PyPy 5.6.0 + py2.7 + psycopg2cffi 2.7.5
msg30976 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-26.19:36:36
Re-open it because tests fail on python3
https://drone.tryton.org/trypod.tryton.org/tryton/trytond/default/bd4fb1ec9ebb33eeb03eee4b801a443e884197b5

I think it is indeed probably a bug in psycopg2cffi. It should not fail when calling str.
New changeset bcea32cb1aae by C?dric Krier in branch 'default':
Backed out changeset bd4fb1ec9ebb
http://hg.tryton.org/trytond/rev/bcea32cb1aae
New changeset bd4fb1ec9ebb by C?dric Krier in branch 'default':
Avoid to convert IntegrityError into string
http://hg.tryton.org/trytond/rev/bd4fb1ec9ebb
review31831002 updated at https://codereview.tryton.org/31831002/#ps1
msg30902 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-22.00:10:43
Should be fixed with review31831002
msg30833 (view) Author: [hidden] (resteve) Date: 2016-12-20.10:22:39
With psycopg2cffi installed (v2.7.5), can't 'ascii' codec when check sql_constrain (and _sql_error_messages?).

The traceback:

12071 140328623490816 [2016-12-20 06:38:33,119] ERROR trytond.protocols.dispatcher <class 'trytond.pool.account.account'>.create(*([{u'kind': u'receivable', u'childs': [], u'name': u'ddd', u'different_party_reconcile': False, u'company': 1, u'taxes': [], u'note': u'', u'active': True, u'code': u'', u'deferral': True, u'general_ledger_balance': False, u'second_currency': None, u'party_required': False, u'type': 1, u'reconcile': False}], {u'date_format': u'%x', u'language': None, u'groups': [12, 1, 11, 6, 18, 14, 8, 3, 4, 5, 7, 21, 2, 17, 19, 13, 10, 15, 9, 16, 22, 20], u'employee': None, u'language_direction': u'ltr', u'company': 1, u'company.rec_name': u'cc', '_check_access': True}), **{}) from admin@185.73.168.17//xxx/
Traceback (most recent call last):
  File "/home/xxx/tryton/trytond/trytond/protocols/dispatcher.py", line 160, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/home/xxx/tryton/trytond/trytond/modules/account_parent_code/account.py", line 98, in create
    accounts = super(Account, cls).create(vlist)
  File "/home/xxx/tryton/trytond/trytond/model/modelsql.py", line 558, in create
    exception, values, transaction=transaction)
  File "/home/xxx/tryton/trytond/trytond/model/modelsql.py", line 307, in __raise_integrity_error
    if name in str(exception):
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 31: ordinal not in range(128)

I check this line [1] and the type is:

<class 'psycopg2cffi._impl.exceptions.IntegrityError'>

Detected in 4.2

[1] https://bitbucket.org/tryton/trytond/src/dd969de519a84a6b3062701a190da1e4ffb3c974/trytond/model/modelsql.py?at=4.2&fileviewer=file-view-default#modelsql.py-306
History
Date User Action Args
2016-12-28 10:46:23restevesetmessages: + msg31014
2016-12-28 10:26:16cedsetmessages: + msg31010
2016-12-28 10:24:17cedsetmessages: + msg31009
2016-12-28 00:09:56cedsetstatus: chatting -> deferred
messages: + msg31000
2016-12-27 23:32:30restevesetmessages: + msg30998
2016-12-26 19:37:08cedsetassignedto: ced ->
2016-12-26 19:36:36cedsetstatus: resolved -> chatting
messages: + msg30976
2016-12-26 19:36:31roundup-botsetmessages: + msg30975
2016-12-26 18:56:13roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg30972
2016-12-22 00:22:30reviewbotsetnosy: + reviewbot
messages: + msg30903

Showing 10 items. Show all history (warning: this could be VERY long)