(self, domain)
:raises IOError: if unable to save (e.g. PIL is unable to save PNG in CMYK mode)
:raises IOError: if unable to save (e.g. PIL is unable to save PNG in CMYK mode)
: raises IOError : if unable to save ( e . g . PIL is unable to save PNG in CMYK mode )
def _save_logo_configuration(self, domain):
        """
        :raises IOError: if unable to save (e.g. PIL is unable to save PNG in CMYK mode)
        """
        if self.can_use_custom_logo:
            logo = self.cleaned_data['logo']
            if logo:

                input_image = Image.open(io.BytesIO(logo.read()))
                input_image.load()
                input_image.thumbnail(LOGO_SIZE)
                # had issues trying to use a BytesIO instead
                tmpfilename = "/tmp/%s_%s" % (uuid.uuid4(), logo.name)
                input_image.save(tmpfilename, 'PNG')

                with open(tmpfilename, 'rb') as tmpfile:
                    domain.put_attachment(tmpfile, name=LOGO_ATTACHMENT)
            elif self.cleaned_data['delete_logo']:
                domain.delete_attachment(LOGO_ATTACHMENT)
def _save_logo_configuration ( self , domain ) : if self . can_use_custom_logo : logo = self . cleaned_data [ 'logo' ] if logo : input_image = Image . open ( io . BytesIO ( logo . read ( ) ) ) input_image . load ( ) input_image . thumbnail ( LOGO_SIZE ) # had issues trying to use a BytesIO instead tmpfilename = "/tmp/%s_%s" % ( uuid . uuid4 ( ) , logo . name ) input_image . save ( tmpfilename , 'PNG' ) with open ( tmpfilename , 'rb' ) as tmpfile : domain . put_attachment ( tmpfile , name = LOGO_ATTACHMENT ) elif self . cleaned_data [ 'delete_logo' ] : domain . delete_attachment ( LOGO_ATTACHMENT )