← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 788118] Re: Bug in binary_image_get_image when no image in the field

 

In theory you are right, but in test, in debug i see res = 'False'  <===
string not boolean.


Use a ide with debug mode and put a breakpoint, you will see res = 'False' and openerp enter in IF because 'False' in string mean True.

-- 
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:
  Invalid

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'"

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-client-web/+bug/788118/+subscriptions


References