← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 788118] [NEW] Bug in binary_image_get_image when no image in the field

 

Public bug reported:

This error never show, bug that grow the error log very fast because we
use many image field.

web/addons/openerp/controllers/form.py

def binary_image_get_image(self, **kw):
        model = kw.get('model')
        field = kw.get('field')
        id = kw.get('id')
        proxy = rpc.RPCProxy(model)
        if id == 'None':
            # FIXME: doesnt honor the context
            res = proxy.default_get([field]).get(field,'')
        else:
            res = proxy.read([int(id)], [field])[0].get(field)
        if res:
            return base64.decodestring(res)
        else:
            return open(openobject.paths.addons('openerp','static','images','placeholder.png'),'rb').read()

When field is null, res = u'False' , so it's True ...  to patch the
problem add  "if res and res != 'False'"

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/788118

Title:
  Bug in binary_image_get_image when no image in the field

Status in OpenERP Web Client:
  New

Bug description:
  This error never show, bug that grow the error log very fast because
  we use many image field.

  web/addons/openerp/controllers/form.py

  def binary_image_get_image(self, **kw):
          model = kw.get('model')
          field = kw.get('field')
          id = kw.get('id')
          proxy = rpc.RPCProxy(model)
          if id == 'None':
              # FIXME: doesnt honor the context
              res = proxy.default_get([field]).get(field,'')
          else:
              res = proxy.read([int(id)], [field])[0].get(field)
          if res:
              return base64.decodestring(res)
          else:
              return open(openobject.paths.addons('openerp','static','images','placeholder.png'),'rb').read()

  When field is null, res = u'False' , so it's True ...  to patch the
  problem add  "if res and res != 'False'"


Follow ups

References