~extra-addons-commiter/product-extra-addons/oerp6.1-stable

« back to all changes in this revision

Viewing changes to product_images_olbs/product_images.py

  • Committer: Sébastien Beau
  • Date: 2012-12-09 15:51:15 UTC
  • Revision ID: sebastien.beau@akretion.com-20121209155115-0svu8nybvfb9hu93
[FIX] product_images : fix when url is empty and link selected

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
    def get_image(self, cr, uid, id, context=None):
96
96
        image = self.browse(cr, uid, id, context=context)
97
97
        if image.link:
98
 
            (filename, header) = urllib.urlretrieve(image.url)
99
 
            with open(filename , 'rb') as f:
100
 
                img = base64.b64encode(f.read())
 
98
            if image.url:
 
99
                (filename, header) = urllib.urlretrieve(image.url)
 
100
                with open(filename , 'rb') as f:
 
101
                    img = base64.b64encode(f.read())
 
102
            else:
 
103
                return False
101
104
        else:
102
105
            try:
103
106
                if isinstance(image.product_id.default_code, bool):