Tryton - Issues



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
Reviews 31831002
View: 31831002

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

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:
msg31010 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-28.10:26:16
Or maybe it is
msg31009 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2016-12-28.10:24:17
It seems it has been fixed by
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()


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

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
New changeset bd4fb1ec9ebb by C?dric Krier in branch 'default':
Avoid to convert IntegrityError into string
review31831002 updated at
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@
Traceback (most recent call last):
  File "/home/xxx/tryton/trytond/trytond/protocols/", line 160, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/home/xxx/tryton/trytond/trytond/modules/account_parent_code/", line 98, in create
    accounts = super(Account, cls).create(vlist)
  File "/home/xxx/tryton/trytond/trytond/model/", line 558, in create
    exception, values, transaction=transaction)
  File "/home/xxx/tryton/trytond/trytond/model/", 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

Date User Action Args
2017-03-01 19:25:43cedsetkeyword: - review
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

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