← Back to team overview

openerp-india team mailing list archive

RES: [Bug 899794] Re: [6.1] Setting an image or binary field may sometimes fail with "TypeError: can't escape non-string object"

 

Here ´s one of images that i had trouble to upload to the server.


-----Mensagem original-----
De: bounces@xxxxxxxxxxxxx [mailto:bounces@xxxxxxxxxxxxx] Em nome de Olivier Dony (OpenERP)
Enviada em: segunda-feira, 20 de fevereiro de 2012 10:08
Para: saito@xxxxxxxxxxxxxxx
Assunto: [Bug 899794] Re: [6.1] Setting an image or binary field may sometimes fail with "TypeError: can't escape non-string object"

On 02/20/2012 12:19 PM, tamnil wrote:
> as described in bug: Bug #919982  by ruy medeiros
> _symbol_f = lambda symb: symb and Binary(str(symb)) or None
<SNIP>
> 
> 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.

Tanmil, Rui, thanks for the very insightful details. I think we are coming
close to the root of the problem. There may indeed be some changes in OpenERP
6.1 that can cause certain binary blobs to be transferred as unicode strings
instead of 8-bit strings.

Would any of you guys mind sharing the image or binary that causes the issue to
occur for you? This could in fact be related to the actual binary content of
the file, and thus could be image-specific.

Based on this we should be able to provide a proper fix (the workaround of Rui
is not bad, but a little bit more of analysis is required)

Thanks!


** Summary changed:

- [6.1] random requests fail with "TypeError: can't escape non-string object"
+ [6.1] Setting an image or binary field may sometimes fail with "TypeError: can't escape non-string object"

** Changed in: openobject-server
   Importance: Undecided => Medium

** Changed in: openobject-server
       Status: Incomplete => Confirmed

** Changed in: openobject-server
    Milestone: None => 6.1

-- 
You received this bug notification because you are subscribed to a
duplicate bug report (934312).
https://bugs.launchpad.net/bugs/899794

Title:
  [6.1] Setting an image or binary field may sometimes fail with
  "TypeError: can't escape non-string object"

Status in OpenERP Server:
  Confirmed

Bug description:
  from a virtual ubuntu 10.04 server installing OpenERP from trunk:
  OpenERP-server rev: 3848
  OpenERP-addons rev: 5861
  OpenERP-web rev: 1596
  using pip for installing essentially all software except python-ldap, postgresql. 

  0) Go to http://<virtualserver>:8069
  Create a new database without demo data
  This should automatically log you in as Admin with a screen to install modules

  1) Click "SETTINGS" 
  2) Click "Set Company Header and Footer"
  3) Click folder icon to add new logo
  4) Click "Save"

  Result is:
  OpenERP Server Error

  Client Traceback (most recent call last):
    File "/opt/openerp/openerp-web/addons/web/common/http.py", line 154, in dispatch
      response["result"] = method(controller, self, **self.params)
    File "/opt/openerp/openerp-web/addons/web/controllers/main.py", line 772, in save
      r = m.write([id], data, req.session.eval_context(req.context))
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 429, in proxy
      *args)
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 306, in proxy
      result = self.connector.send(self.service_name, method, *args)
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 276, in send
      raise fault

  
  Server Traceback (most recent call last):
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 257, in send
      result = openerp.netsvc.dispatch_rpc(service_name, method, args)
    File "/opt/openerp/openerp-server/openerp/netsvc.py", line 325, in dispatch_rpc
      result = ExportService.getService(service_name).dispatch(method, params)
    File "/opt/openerp/openerp-server/openerp/service/web_services.py", line 580, in dispatch
      res = fn(db, uid, *params)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 120, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 172, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/opt/openerp/openerp-server/openerp/addons/base/res/res_company.py", line 240, in write
      return super(res_company, self).write(cr, *args, **argv)
    File "/opt/openerp/openerp-server/openerp/osv/orm.py", line 3854, in write
      'where id IN %s', upd1 + [sub_ids])
    File "/opt/openerp/openerp-server/openerp/sql_db.py", line 153, in wrapper
      return f(self, *args, **kwargs)
    File "/opt/openerp/openerp-server/openerp/sql_db.py", line 215, in execute
      res = self._obj.execute(query, params)
  TypeError: can't escape non-string object

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/899794/+subscriptions
-----
Nenhum vírus encontrado nessa mensagem.
Verificado por AVG - www.avgbrasil.com.br
Versão: 2012.0.1913 / Banco de dados de vírus: 2113/4821 - Data de Lançamento: 02/20/12


** Attachment added: "2R-UG01.jpg"
   https://bugs.launchpad.net/bugs/899794/+attachment/2761866/+files/2R-UG01.jpg

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

Title:
  [6.1] Setting an image or binary field may sometimes fail with
  "TypeError: can't escape non-string object"

Status in OpenERP Server:
  Confirmed

Bug description:
  from a virtual ubuntu 10.04 server installing OpenERP from trunk:
  OpenERP-server rev: 3848
  OpenERP-addons rev: 5861
  OpenERP-web rev: 1596
  using pip for installing essentially all software except python-ldap, postgresql. 

  0) Go to http://<virtualserver>:8069
  Create a new database without demo data
  This should automatically log you in as Admin with a screen to install modules

  1) Click "SETTINGS" 
  2) Click "Set Company Header and Footer"
  3) Click folder icon to add new logo
  4) Click "Save"

  Result is:
  OpenERP Server Error

  Client Traceback (most recent call last):
    File "/opt/openerp/openerp-web/addons/web/common/http.py", line 154, in dispatch
      response["result"] = method(controller, self, **self.params)
    File "/opt/openerp/openerp-web/addons/web/controllers/main.py", line 772, in save
      r = m.write([id], data, req.session.eval_context(req.context))
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 429, in proxy
      *args)
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 306, in proxy
      result = self.connector.send(self.service_name, method, *args)
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 276, in send
      raise fault

  
  Server Traceback (most recent call last):
    File "/opt/openerp/openerp-web/addons/web/common/openerplib/main.py", line 257, in send
      result = openerp.netsvc.dispatch_rpc(service_name, method, args)
    File "/opt/openerp/openerp-server/openerp/netsvc.py", line 325, in dispatch_rpc
      result = ExportService.getService(service_name).dispatch(method, params)
    File "/opt/openerp/openerp-server/openerp/service/web_services.py", line 580, in dispatch
      res = fn(db, uid, *params)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 120, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 172, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/opt/openerp/openerp-server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/opt/openerp/openerp-server/openerp/addons/base/res/res_company.py", line 240, in write
      return super(res_company, self).write(cr, *args, **argv)
    File "/opt/openerp/openerp-server/openerp/osv/orm.py", line 3854, in write
      'where id IN %s', upd1 + [sub_ids])
    File "/opt/openerp/openerp-server/openerp/sql_db.py", line 153, in wrapper
      return f(self, *args, **kwargs)
    File "/opt/openerp/openerp-server/openerp/sql_db.py", line 215, in execute
      res = self._obj.execute(query, params)
  TypeError: can't escape non-string object

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


References