← Back to team overview

openerp-india team mailing list archive

[Bug 919982] Re: [trunk] base_contact module error

 

*** This bug is a duplicate of bug 899794 ***
    https://bugs.launchpad.net/bugs/899794

Hi,

I'm using Ubuntu 10.04 with Postgresql 8.4.10, psycopg 2.4.4, Openerp
6.1 RC1 and got struck with this error too. All forms with binary fields
in the model were causing this error.

After fiddling in google, I found this bug report
http://psycopg.lighthouseapp.com/projects/62710/tickets/51-typeerror-
cant-escape-unicode-to-binary-writing-unicode-into-bytea which made me
suspicious that openerp was trying to convert to binary the form field
as unicode, thus psycopg threw the error.

I have no idea if this is the right fix, but what I did to sort it out
was to cast the form field content as a string before the binary
conversion by psycopg in osv/fields.py the end result is:

_symbol_f = lambda symb: symb and Binary(str(symb)) or None

on line 296 of osv/fields.py

Again, I have no idea whatsoever if this is the right fix, I'm sure this
is where the problem is caused though.

Best regards,

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/919982

Title:
  [trunk] base_contact module error

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  openobject-addons trunk  base_contact, openerp-web
  Error when try to create new contact.

  Traceback (most recent call last):
    File "/home/prospwro/openerp/server/openerp/osv/osv.py", line 120, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/prospwro/openerp/server/openerp/osv/osv.py", line 175, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/prospwro/openerp/server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/prospwro/openerp/server/openerp/osv/orm.py", line 4154, in create
      cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
    File "/home/prospwro/openerp/server/openerp/sql_db.py", line 152, in wrapper
      return f(self, *args, **kwargs)
    File "/home/prospwro/openerp/server/openerp/sql_db.py", line 214, in execute
      res = self._obj.execute(query, params)
  TypeError: can't escape unicode to binary

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/919982/+subscriptions


References